1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

package: allow 'tee' to catch up before returning (re: beb3c64a)

In the referenced commit message I neglected to mention that, when
doing bin/package make, we're now running 'tee' in the background
again and the building job in the foreground, as opposed to the
other way around. Foreground jobs are more reliably interruptable.
But that reintroduced the problem fixed in 5b8d29d3. Now I don't
know what I was thinking then -- the obvious fix is to add a 'wait'
command, allowing 'tee' to catch up before returning to the prompt.
This commit is contained in:
Martijn Dekker 2021-12-14 22:33:59 +01:00
parent 6137b99a6b
commit 7c30a59e25
2 changed files with 16 additions and 2 deletions

View file

@ -2821,6 +2821,7 @@ showenv()
capture() # file command ... capture() # file command ...
{ {
tee_pid=
case $make:$noexec in case $make:$noexec in
:) case $action in :) case $action in
install|make|view) install|make|view)
@ -2883,7 +2884,7 @@ capture() # file command ...
then TEE=tee then TEE=tee
fi fi
# Connect 'tee' to a FIFO instead of a pipe, so that we can obtain # Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
# the build's exit status with 'wait' and use it for $error_status # the build's exit status and use it for $error_status
rm -f $o.fifo rm -f $o.fifo
mkfifo -m 600 $o.fifo || exit mkfifo -m 600 $o.fifo || exit
( (
@ -2892,6 +2893,7 @@ capture() # file command ...
exec rm $o.fifo exec rm $o.fifo
) & ) &
$TEE -a $o < $o.fifo & $TEE -a $o < $o.fifo &
tee_pid=$!
o=$o.fifo o=$o.fifo
;; ;;
esac esac
@ -2910,6 +2912,11 @@ capture() # file command ...
if test "$exit_status" -gt "$error_status" if test "$exit_status" -gt "$error_status"
then error_status=$exit_status then error_status=$exit_status
fi fi
case $tee_pid in
?*) # allow 'tee' to catch up before returning to prompt
wait "$tee_pid"
;;
esac
} }
make_recurse() # dir make_recurse() # dir

View file

@ -2821,6 +2821,7 @@ showenv()
capture() # file command ... capture() # file command ...
{ {
tee_pid=
case $make:$noexec in case $make:$noexec in
:) case $action in :) case $action in
install|make|view) install|make|view)
@ -2883,7 +2884,7 @@ capture() # file command ...
then TEE=tee then TEE=tee
fi fi
# Connect 'tee' to a FIFO instead of a pipe, so that we can obtain # Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
# the build's exit status with 'wait' and use it for $error_status # the build's exit status and use it for $error_status
rm -f $o.fifo rm -f $o.fifo
mkfifo -m 600 $o.fifo || exit mkfifo -m 600 $o.fifo || exit
( (
@ -2892,6 +2893,7 @@ capture() # file command ...
exec rm $o.fifo exec rm $o.fifo
) & ) &
$TEE -a $o < $o.fifo & $TEE -a $o < $o.fifo &
tee_pid=$!
o=$o.fifo o=$o.fifo
;; ;;
esac esac
@ -2910,6 +2912,11 @@ capture() # file command ...
if test "$exit_status" -gt "$error_status" if test "$exit_status" -gt "$error_status"
then error_status=$exit_status then error_status=$exit_status
fi fi
case $tee_pid in
?*) # allow 'tee' to catch up before returning to prompt
wait "$tee_pid"
;;
esac
} }
make_recurse() # dir make_recurse() # dir