[Quick Start] Avoid starting a browser when no index is generated

This commit is contained in:
Salvador E. Tropea 2022-09-07 13:26:06 -03:00
parent f156a23f3f
commit 33dda2c3ac
1 changed files with 3 additions and 2 deletions

View File

@ -950,8 +950,9 @@ def generate_examples(start_dir, dry, types):
GS.debug_level = old_lvl
logger.info('')
# Try to open a browser
if os.environ.get('DISPLAY') and which('x-www-browser'):
Popen(['x-www-browser', os.path.join(GS.out_dir, 'index.html')])
index = os.path.join(GS.out_dir, 'index.html')
if os.environ.get('DISPLAY') and which('x-www-browser') and os.path.isfile(index):
Popen(['x-www-browser', index])
# To avoid circular dependencies: Optionable needs it, but almost everything needs Optionable