diff --git a/CHANGELOG.md b/CHANGELOG.md index 183a8e41..ff7daa2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - `--jobs auto` / `-j auto` caps parallel concurrency at the CPU core count (portable across Linux/macOS/BSD); the default stays unlimited (#766) ### Changed +- Faster test runs: each test's subshell result payload is emitted with `printf` (a builtin) instead of a `cat < 1 `mkdir` forks per cold start). No behaviour change - Faster test runs: the runner detects a failed source (syntax error / unexpected EOF) and discovery detects the `.bash` pattern variant with shell `case` matches instead of `grep` forks (2 -> 0 `grep` forks per sourced test file). No behaviour change - Faster cold start: the base64 `-w` capability is detected with a shell `case` on `base64 --help` instead of piping into a `grep` fork (1 -> 0 `grep` forks per cold start). Same detection, no behaviour change diff --git a/src/state.sh b/src/state.sh index 52f91255..99a2b25f 100644 --- a/src/state.sh +++ b/src/state.sh @@ -262,7 +262,11 @@ function bashunit::state::export_subshell_context() { bashunit::state::encode_field "$_BASHUNIT_TEST_HOOK_MESSAGE" encoded_test_hook_message=$_BASHUNIT_STATE_ENCODED_OUT - cat <"$fixture" + + local trace + trace="$(PS4='+ ' bash -x ./bashunit --no-parallel "$fixture" 2>&1 >/dev/null)" + + local cat_forks + cat_forks="$(printf '%s\n' "$trace" | grep -cE '^\++ +/?[a-z/]*cat( |$)' || true)" + + assert_less_or_equal_than 1 "$cat_forks" +}