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

package: don't exit prematurely (re: 3e140727, 936802f9, d18469d6)

Sometimes the shell returned to the prompt before bin/package was
finished writing all of its output. The problem was that 'tee',
which is used to write the output to both the terminal and the log
in arch/*lib/package/gen/make.out, hadn't caught up yet.

bin/package, src/cmd/INIT/package.sh:
- Run the build itself in the background and 'tee' in the
  foreground. This way, the script will not terminate until 'tee'
  is finished. The build's exit status is obtained with 'wait'.
This commit is contained in:
Martijn Dekker 2021-03-16 12:54:38 +00:00
parent 4f9ce41aaa
commit 5b8d29d358
2 changed files with 12 additions and 10 deletions

View file

@ -4008,8 +4008,8 @@ capture() # file command ...
0) if executable ! $TEE 0) if executable ! $TEE
then TEE=tee then TEE=tee
fi fi
# Connect 'tee' to a FIFO instead of a pipe, so that the build is invoked from # Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
# the main shell environment and its exit status can be used for $error_status # the build's exit status with 'wait' 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
( (
@ -4017,14 +4017,15 @@ capture() # file command ...
# unlink early # unlink early
exec rm $o.fifo exec rm $o.fifo
) & ) &
$TEE -a $o < $o.fifo & (
{
case $s in case $s in
?*) echo "$s" ;; ?*) echo "$s" ;;
esac esac
showenv $action showenv $action
"$@" "$@"
} < /dev/null > $o.fifo 2>&1 ) < /dev/null > $o.fifo 2>&1 &
$TEE -a $o < $o.fifo
wait $! # obtain exit status from build
;; ;;
*) { *) {
case $s in case $s in

View file

@ -4008,8 +4008,8 @@ capture() # file command ...
0) if executable ! $TEE 0) if executable ! $TEE
then TEE=tee then TEE=tee
fi fi
# Connect 'tee' to a FIFO instead of a pipe, so that the build is invoked from # Connect 'tee' to a FIFO instead of a pipe, so that we can obtain
# the main shell environment and its exit status can be used for $error_status # the build's exit status with 'wait' 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
( (
@ -4017,14 +4017,15 @@ capture() # file command ...
# unlink early # unlink early
exec rm $o.fifo exec rm $o.fifo
) & ) &
$TEE -a $o < $o.fifo & (
{
case $s in case $s in
?*) echo "$s" ;; ?*) echo "$s" ;;
esac esac
showenv $action showenv $action
"$@" "$@"
} < /dev/null > $o.fifo 2>&1 ) < /dev/null > $o.fifo 2>&1 &
$TEE -a $o < $o.fifo
wait $! # obtain exit status from build
;; ;;
*) { *) {
case $s in case $s in