Skip to content

fix: time out hanging command checks - #296

Open
mikemikimike wants to merge 2 commits into
GatorEducator:masterfrom
mikemikimike:fix/270-command-timeout
Open

fix: time out hanging command checks#296
mikemikimike wants to merge 2 commits into
GatorEducator:masterfrom
mikemikimike:fix/270-command-timeout

Conversation

@mikemikimike

Copy link
Copy Markdown

Linked Issue

Fixes #270

Description

run_command now accepts a 30-second default timeout. Callers can provide a shorter timeout for bounded execution. When a command expires, the process tree is terminated on Windows with taskkill /T (and the process is killed on POSIX), remaining output is collected, and a deterministic failure code plus actionable diagnostic are returned.

Compatibility

Existing callers retain the same successful result shape. Commands that exceed the limit now fail instead of hanging indefinitely.

Test Coverage

  • python -m pytest tests/test_run.py::test_run_command_times_out_and_terminates_child -q --basetemp .pytest-tmp — 1 passed
  • python -m pytest tests/test_run.py tests/test_invoke.py -q --basetemp .pytest-tmp — 37 passed; 6 pre-existing Windows command-shell portability failures (ls/true are not available on Windows)
  • python -m flake8 gator/run.py tests/test_run.py — passed
  • git diff --check — passed

The documented Pipenv task command was not available in this environment. The focused timeout regression uses a real sleeping child process and verifies the returned diagnostic and exit code.

AI Assistance

AI-assisted; the process-tree cleanup and regression test were reviewed against the existing subprocess API.

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.

bug: Prevent command checks from hanging indefinitely

1 participant