From fb19ec05d10071b495bfb44fbfe81fbbb55c7368 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Sat, 14 Mar 2026 00:58:39 +0800 Subject: [PATCH] Fix: sys.exit(1) runs unconditionally due to indentation bug The sys.exit(1) was at the same indentation level as try block, causing it to run unconditionally after subprocess finishes - even when the command succeeds. Moved inside except block. Fixes: microsoft/BitNet#447 --- setup_env.py | 2 +- utils/e2e_benchmark.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_env.py b/setup_env.py index 3bf5fb8f7..4ef7683b8 100644 --- a/setup_env.py +++ b/setup_env.py @@ -104,7 +104,7 @@ def run_command(command, shell=False, log_step=None): subprocess.run(command, shell=shell, check=True) except subprocess.CalledProcessError as e: logging.error(f"Error occurred while running command: {e}") - sys.exit(1) + sys.exit(1) def prepare_model(): _, arch = system_info() diff --git a/utils/e2e_benchmark.py b/utils/e2e_benchmark.py index 07f93ed72..464780bd5 100644 --- a/utils/e2e_benchmark.py +++ b/utils/e2e_benchmark.py @@ -20,7 +20,7 @@ def run_command(command, shell=False, log_step=None): subprocess.run(command, shell=shell, check=True) except subprocess.CalledProcessError as e: logging.error(f"Error occurred while running command: {e}") - sys.exit(1) + sys.exit(1) def run_benchmark(): build_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "build")