From 45e8ed5c8755107316f5ccef236f3e834726330a Mon Sep 17 00:00:00 2001 From: Daniel D'Avella Date: Tue, 19 Dec 2023 21:24:26 -0500 Subject: [PATCH] Log codemodder errors and exit --- src/pixee/cli.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pixee/cli.py b/src/pixee/cli.py index 07f114b..fe7ebf5 100644 --- a/src/pixee/cli.py +++ b/src/pixee/cli.py @@ -161,7 +161,7 @@ def run_codemodder( ) command = subprocess.Popen( [codemodder, "--output", codetf.name, path] + common_codemodder_args, - stderr=subprocess.DEVNULL, + stderr=subprocess.PIPE, stdout=subprocess.PIPE if not verbose else None, ) if command.stdout: @@ -169,6 +169,14 @@ def run_codemodder( if line.startswith(b"running codemod"): progress.advance(task) command.wait() + if command.returncode != 0: + console.print( + f"Error running codemodder: {codemodder} (exit code {command.returncode})" + ) + if command.stderr: + console.print(command.stderr.read().decode("utf-8")) + sys.exit(1) + progress.update(task, completed=num_codemods) return json.load(codetf)