mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Improve error handling for docs-build test.
This commit is contained in:
parent
0677dabad4
commit
2148999048
1 changed files with 16 additions and 5 deletions
|
@ -3,21 +3,32 @@
|
|||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
base_dir = os.getcwd() + os.sep
|
||||
base_dir = os.getcwd() + os.path.sep
|
||||
docs_dir = os.path.abspath('docs/docsite')
|
||||
cmd = ['make', 'singlehtmldocs']
|
||||
|
||||
sphinx = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=docs_dir)
|
||||
stdout, stderr = sphinx.communicate()
|
||||
|
||||
stdout = stdout.decode('utf-8')
|
||||
stderr = stderr.decode('utf-8')
|
||||
|
||||
if sphinx.returncode != 0:
|
||||
print("Command '%s' failed with status code: %d" % (' '.join(cmd), sphinx.returncode))
|
||||
print(stdout)
|
||||
print(stderr)
|
||||
return
|
||||
sys.stderr.write("Command '%s' failed with status code: %d\n" % (' '.join(cmd), sphinx.returncode))
|
||||
|
||||
if stdout.strip():
|
||||
sys.stderr.write("--> Standard Output\n")
|
||||
sys.stderr.write("%s\n" % stdout.strip())
|
||||
|
||||
if stderr.strip():
|
||||
sys.stderr.write("--> Standard Error\n")
|
||||
sys.stderr.write("%s\n" % stderr.strip())
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
with open('docs/docsite/rst_warnings', 'r') as warnings_fd:
|
||||
output = warnings_fd.read().strip()
|
||||
|
|
Loading…
Reference in a new issue