From c1fbf1eb5f32e52a59d19abeffd75d1ac381e572 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 6 Dec 2022 20:03:25 +0100 Subject: [PATCH] Handle crashes during test --- test.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test.py b/test.py index b306d7d..b5a0025 100755 --- a/test.py +++ b/test.py @@ -42,9 +42,16 @@ def main(): print(f"{GRAY}No solution{RESET} for {inputpath}") continue - resultstr = subprocess.run( - args.command + [inputpath], check=True, capture_output=True, text=True - ).stdout + try: + resultstr = subprocess.run( + args.command + [inputpath], + check=True, + text=True, + capture_output=True, + ).stdout + except subprocess.CalledProcessError: + print(f"{RED}Crashed{RESET} on {inputpath}") + continue if resultstr.strip() == solutionstr.strip(): print(f"{GREEN}Passed{RESET} {inputpath}")