Context
Scripts sometimes call external tools that can hang. GNU systems often provide timeout; macOS may provide gtimeout through Homebrew coreutils, or no timeout binary at all. lib_std.sh should offer a small wrapper with clear behavior and Base-style command execution semantics.
Scope
Add a Base-native timeout-aware command helper to lib_std.sh. Do not copy external implementations.
Acceptance Criteria
- Public helper runs a command with a timeout while preserving argument boundaries.
- Prefer
timeout, then gtimeout, when present.
- Define and test clear behavior when neither timeout binary is available.
- Preserve command exit status on normal command failure.
- Support caller-handled failures in a style consistent with
std_run --no-exit.
- Do not use
eval.
- Public API and behavior are documented in
lib/bash/std/README.md.
- BATS coverage verifies success, command failure, timeout, missing command, missing timeout binary fallback, and invalid arguments.
Validation
- Focused stdlib BATS coverage.
./tests/validate.sh
- `git diff --check
Context
Scripts sometimes call external tools that can hang. GNU systems often provide
timeout; macOS may providegtimeoutthrough Homebrew coreutils, or no timeout binary at all.lib_std.shshould offer a small wrapper with clear behavior and Base-style command execution semantics.Scope
Add a Base-native timeout-aware command helper to
lib_std.sh. Do not copy external implementations.Acceptance Criteria
timeout, thengtimeout, when present.std_run --no-exit.eval.lib/bash/std/README.md.Validation
./tests/validate.sh