Skip to content

Commit b9cceaa

Browse files
committed
py/makeqstrdefs.py: Propagate out errors from parallel pp step.
Commit e6380fa changed the pp step from `subprocess.check_output()` to use `subprocess.Popen()`, but did not check the return code of the process. That means any process errors (eg compiler error) are swallowed and do not stop the build. This commit fixes that by explicitly checking `proc.returncode` once the process is complete, and raising an exception. Signed-off-by: Damien George <damien@micropython.org>
1 parent 228d96d commit b9cceaa

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

py/makeqstrdefs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def pp(flags):
6868
def run(files):
6969
try:
7070
filtered_lines = []
71-
with subprocess.Popen(args.pp + flags + files, stdout=subprocess.PIPE) as proc:
71+
cmd = args.pp + flags + files
72+
with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc:
7273
recent_file = None
7374
for line in proc.stdout:
7475
if line.isspace():
@@ -80,6 +81,9 @@ def run(files):
8081
filtered_lines.append(recent_file)
8182
recent_file = None
8283
filtered_lines.append(line)
84+
proc.wait()
85+
if proc.returncode:
86+
raise PreprocessorError("command failed: " + " ".join(cmd))
8387
return b"".join(filtered_lines)
8488
except subprocess.CalledProcessError as er:
8589
raise PreprocessorError(str(er))

0 commit comments

Comments
 (0)