mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 14:07:53 +00:00
Improve test framework: forked commands inherit stdin
Remove the subshell parentheses around the command invoked using fork(), so that the forked command inherits the file descriptors. This allows it to be used like "fork some command < input".
This commit is contained in:
parent
2bb0d2047a
commit
9953949c6e
@ -1651,7 +1651,7 @@ fork() {
|
|||||||
local _tfw_process_tmp="$_tfw_tmp/fork-$forkid"
|
local _tfw_process_tmp="$_tfw_tmp/fork-$forkid"
|
||||||
mkdir "$_tfw_process_tmp" || _tfw_fatalexit
|
mkdir "$_tfw_process_tmp" || _tfw_fatalexit
|
||||||
$_tfw_assert_noise && tfw_log "# fork[$forkid] START" $(shellarg "$@")
|
$_tfw_assert_noise && tfw_log "# fork[$forkid] START" $(shellarg "$@")
|
||||||
( "$@" ) 6>"$_tfw_process_tmp/log.stdout" 1>&6 2>"$_tfw_process_tmp/log.stderr" 7>"$_tfw_process_tmp/log.xtrace" &
|
"$@" 6>"$_tfw_process_tmp/log.stdout" 1>&6 2>"$_tfw_process_tmp/log.stderr" 7>"$_tfw_process_tmp/log.xtrace" &
|
||||||
_tfw_forked_pids[$forkid]=$!
|
_tfw_forked_pids[$forkid]=$!
|
||||||
[ -n "$_tfw_forklabel" ] && eval _tfw_fork_label_$_tfw_forklabel=$forkid
|
[ -n "$_tfw_forklabel" ] && eval _tfw_fork_label_$_tfw_forklabel=$forkid
|
||||||
$_tfw_assert_noise && tfw_log "# fork[$forkid] ${_tfw_forklabel:+%$_tfw_forklabel }pid=$! STARTED"
|
$_tfw_assert_noise && tfw_log "# fork[$forkid] ${_tfw_forklabel:+%$_tfw_forklabel }pid=$! STARTED"
|
||||||
|
Loading…
Reference in New Issue
Block a user