Summary
Two spots still capture a return value through $( ) where the house return-slot pattern already exists next door.
Current behavior
Per passing test. src/console/test_line.sh:33-37:
full_line="$(bashunit::str::rpad "$line" "$_BASHUNIT_CONSOLE_DURATION_OUT")"
bashunit::str::rpad (src/util/str.sh:92) is already fork-free inside. The subshell around it is the whole cost. Its neighbours already have slot variants: strip_ansi_to_slot (src/util/str.sh:23) and format_duration_to_slot (src/console/duration.sh:11).
This one fires on Bash 5, not on 3.2, because auto disables per-test timing when the clock is a perl fork (src/config/env.sh:524-529, src/util/clock.sh:95).
The failure renderers have the same shape at src/console/test_line.sh:71, :123, :192, :207, :223 and :256, on the failure path only.
Per file with a file hook. src/runner/hooks.sh:172, :189, :423, :440:
local start_time
start_time=$(bashunit::clock::now)
bashunit::clock::now_to_slot (src/util/clock.sh:111) is the fork-free variant, and run_test was already converted to it (src/runner/exec.sh:542, :599). These four were missed. On Bash 3.2 each one is a subshell wrapping a perl fork, twice per set_up_before_script and twice per tear_down_after_script. This suite has 115 files with the former.
bashunit::clock::init (src/util/clock.sh:234) captures $(bashunit::clock::now) the same way, once per run.
Expected behavior
Add bashunit::str::rpad_to_slot and use it. Switch the four hook clock reads and clock::init to now_to_slot.
Small next to #1 and #2, and grouped here because it is the same one-line change four times over. Unit-test rpad_to_slot against rpad on the same inputs, including an ANSI-coloured string and one over 1024 chars, since that is where strip_ansi_to_slot changes strategy (src/util/str.sh:82).
Summary
Two spots still capture a return value through
$( )where the house return-slot pattern already exists next door.Current behavior
Per passing test.
src/console/test_line.sh:33-37:full_line="$(bashunit::str::rpad "$line" "$_BASHUNIT_CONSOLE_DURATION_OUT")"bashunit::str::rpad(src/util/str.sh:92) is already fork-free inside. The subshell around it is the whole cost. Its neighbours already have slot variants:strip_ansi_to_slot(src/util/str.sh:23) andformat_duration_to_slot(src/console/duration.sh:11).This one fires on Bash 5, not on 3.2, because
autodisables per-test timing when the clock is aperlfork (src/config/env.sh:524-529,src/util/clock.sh:95).The failure renderers have the same shape at
src/console/test_line.sh:71,:123,:192,:207,:223and:256, on the failure path only.Per file with a file hook.
src/runner/hooks.sh:172,:189,:423,:440:bashunit::clock::now_to_slot(src/util/clock.sh:111) is the fork-free variant, andrun_testwas already converted to it (src/runner/exec.sh:542,:599). These four were missed. On Bash 3.2 each one is a subshell wrapping aperlfork, twice perset_up_before_scriptand twice pertear_down_after_script. This suite has 115 files with the former.bashunit::clock::init(src/util/clock.sh:234) captures$(bashunit::clock::now)the same way, once per run.Expected behavior
Add
bashunit::str::rpad_to_slotand use it. Switch the four hook clock reads andclock::inittonow_to_slot.Small next to #1 and #2, and grouped here because it is the same one-line change four times over. Unit-test
rpad_to_slotagainstrpadon the same inputs, including an ANSI-coloured string and one over 1024 chars, since that is wherestrip_ansi_to_slotchanges strategy (src/util/str.sh:82).