scripts: Show asciidoc errors while discovering

This commit is contained in:
Florian Bruhin 2022-12-12 09:51:22 +01:00
parent 4c9050d4be
commit b63cdf19f4
1 changed files with 8 additions and 3 deletions

View File

@ -234,11 +234,16 @@ class AsciiDoc:
for executable in ['asciidoc', 'asciidoc.py']:
try:
subprocess.run([executable, '--version'],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
capture_output=True,
text=True,
check=True)
except OSError:
except FileNotFoundError:
pass
except OSError as e:
utils.print_error(f"While running {executable}: {e}")
except subprocess.CalledProcessError as e:
utils.print_error(
f"While running {executable}: {e}\n{e.stdout}\n{e.stderr}")
else:
return [executable]