Skip to content

Fix: sys.exit(1) runs unconditionally due to indentation bug#455

Open
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix-sys-exit-indent
Open

Fix: sys.exit(1) runs unconditionally due to indentation bug#455
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix-sys-exit-indent

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 13, 2026

Description

The sys.exit(1) was at the same indentation level as the try block, causing it to run unconditionally after subprocess completes - even when the command succeeds. This fix moves sys.exit(1) inside the except block.

Bug Details

In the run_command function, when log_step is None (the else branch), the sys.exit(1) was placed outside the except block:

else:
    try:
        subprocess.run(command, shell=shell, check=True)
    except subprocess.CalledProcessError as e:
        logging.error(f"Error occurred while running command: {e}")
    sys.exit(1)  # BUG: Runs unconditionally!

The fix properly indents sys.exit(1) to be inside the except block.

Affected Files

  • setup_env.py (line ~110)
  • utils/e2e_benchmark.py (line ~23)

Related Issue

This PR addresses issue #447

The sys.exit(1) was at the same indentation level as the try block,
causing it to run unconditionally after subprocess completes - even when
the command succeeds. This fix moves sys.exit(1) inside the except block.

Affected files:
- setup_env.py (line ~110)
- utils/e2e_benchmark.py (line ~23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant