aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-01-19 13:29:35 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-19 15:27:22 +0000
commitd807e0789b279a1176de17b5169e7301296738ee (patch)
tree56ab13b4e8413cd7ce3f331bf6795ea6d5c95d15
parentdc0632d419ef6dce30772f707d0c2fa443310505 (diff)
doc: Fix error handling in qdoc_spawner
Check on the exit code, not on the presence of warnings on stderr to determine failures. Amends 9bbbb29809ec7552698680a40e20ec271d929c67, cb4d09368dd3719e3e17afa07020c4d41fb03100 Task-number: PYSIDE-1106 Change-Id: I092b5f991c1bb114a1d51f73bd833da5aedaeda8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 5dabf393f6175070890483040ee361ee59a84da2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/pyside6/doc/qdoc_spawner.py.in31
1 files changed, 16 insertions, 15 deletions
diff --git a/sources/pyside6/doc/qdoc_spawner.py.in b/sources/pyside6/doc/qdoc_spawner.py.in
index fb0a8f2cd..0223e50ee 100644
--- a/sources/pyside6/doc/qdoc_spawner.py.in
+++ b/sources/pyside6/doc/qdoc_spawner.py.in
@@ -5,6 +5,7 @@ import argparse
import subprocess
import os
import sys
+import time
from multiprocessing import Pool, cpu_count
from pathlib import Path
@@ -27,23 +28,23 @@ def run_qdoc(file, qdoc_args, args):
args.doc_data_dir,
]
+ start_time = time.time()
_ = subprocess.Popen(command, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = _.communicate()
+ returncode = _.wait()
+ duration = round(time.time() - start_time)
- if args.verbose:
- _out, _err = _.communicate()
- out = _out.decode("utf-8")
- err = _err.decode("utf-8")
+ if args.verbose or returncode != 0 or err:
+ cmd_str = " ".join(command)
+ print(f"> Output of: {cmd_str}")
+ if out:
+ print(out.decode("utf-8"), file=sys.stdout)
+ if err:
+ print(err.decode("utf-8"), file=sys.stderr)
+ print(f"> Finished: {file} {duration}s (exit code {returncode})")
- if out:
- print(out, file=sys.stdout)
- if err:
- print(err, file=sys.stderr)
- raise Exception(f"Failing executing the command {command}")
- else:
- _.wait()
-
- if args.verbose:
- print(f"> Finished: {file}")
+ if returncode != 0:
+ raise Exception(f"Failing executing the command {command} ({returncode})")
def get_qdocconf_files():
@@ -94,5 +95,5 @@ if __name__ == "__main__":
with Pool(int(parallel)) as p:
p.starmap(run_qdoc, [(str(f), ["-single-exec"], args) for f in files_single_exec])
except Exception as e:
- print(f"Error while running qdoc_spawner: {e}", file=sys.stderr)
+ print(f"qdoc_spawner: error: {e}", file=sys.stderr)
sys.exit(-1)