Skip to content

Commit 3dd6ef5

Browse files
committed
fuzz: Output error log even when subprocess returns non-0 exit code
Before, subprocess.run() would throw CalledProcessError from inside the logging.debug() call, preventing the latter from completing.
1 parent eeee163 commit 3dd6ef5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/fuzz/test_runner.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,8 @@ def generate_corpus(*, fuzz_pool, src_dir, fuzz_bin, corpus_dir, targets):
257257

258258
def job(command, t, t_env):
259259
logging.debug(f"Running '{command}'")
260-
logging.debug("Command '{}' output:\n'{}'\n".format(
261-
command,
262-
subprocess.run(
260+
try:
261+
process = subprocess.run(
263262
command,
264263
env={
265264
**t_env,
@@ -268,8 +267,13 @@ def job(command, t, t_env):
268267
check=True,
269268
stderr=subprocess.PIPE,
270269
text=True,
271-
).stderr,
272-
))
270+
)
271+
output = process.stderr
272+
except subprocess.CalledProcessError as e:
273+
output = e.stderr
274+
else:
275+
raise
276+
logging.debug(f"Command '{command}' output:\n'{output}'\n")
273277

274278
futures = []
275279
for target, t_env in targets:

0 commit comments

Comments
 (0)