Skip to content

fix: add timeout to run_command() to prevent indefinite hangs - #3964

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/subprocess-timeout-utils
Open

fix: add timeout to run_command() to prevent indefinite hangs#3964
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/subprocess-timeout-utils

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

"run_command() utility called subprocess.run() without timeout. If a spawned process hangs, the CLI blocks forever.

Fix

  • Add imeout parameter (default 120s)
  • Handle subprocess.TimeoutExpired exception
  • Remove redundant hasattr(e, 'stderr') check

Add a timeout parameter (default 120s) to subprocess.run() calls in
run_command() utility. Previously, if a spawned process hung, the CLI
would block forever with no way to recover.

Also removes redundant hasattr(e, 'stderr') check on CalledProcessError
which always has a stderr attribute when capture_output=True.

Assisted-by: GitHub Copilot (model: mimo-v2-free, supervised)
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