Problem
At main commit a107134, the Bash timeout fallback in lib/bash/std/lib_std.sh signals only command_pid. If that command starts a background child, the parent can be terminated and std_run can return 124 while the child continues running.
An isolated repro used a shell function that started /bin/sleep 20 in the background and waited. __std_run_with_timeout_fallback__ 1 worker returned 124, but kill -0 <child-pid> still succeeded afterward.
This violates the documented expectation that --timeout bounds a command attempt and makes fallback behavior weaker than the preferred timeout executable path.
Scope
- Make the fallback terminate the command and descendants it starts, without signaling unrelated processes in the caller's process group.
- Preserve the TERM-then-KILL grace-period behavior and final status
124.
- Document the process-tree contract for timeout execution.
- Add a regression that forces the fallback and proves a background child is gone before the helper returns.
Acceptance Criteria
- A timed-out command with a long-running background child leaves neither process alive.
- TERM-ignoring commands and descendants are killed within the existing bounded grace period.
- Commands that finish normally still preserve their original status.
- The focused stdlib tests and full validation pass on macOS and Linux.
Validation
bats lib/bash/std/tests/lib_std.bats
./tests/validate.sh
git diff --check
Problem
At
maincommita107134, the Bash timeout fallback inlib/bash/std/lib_std.shsignals onlycommand_pid. If that command starts a background child, the parent can be terminated andstd_runcan return124while the child continues running.An isolated repro used a shell function that started
/bin/sleep 20in the background and waited.__std_run_with_timeout_fallback__ 1 workerreturned124, butkill -0 <child-pid>still succeeded afterward.This violates the documented expectation that
--timeoutbounds a command attempt and makes fallback behavior weaker than the preferred timeout executable path.Scope
124.Acceptance Criteria
Validation
bats lib/bash/std/tests/lib_std.bats./tests/validate.shgit diff --check