1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

package: fix SIGINT and SIGHUP handling

The package script was not well behaved with these. When you
pressed Ctrl+C, on some shells (including ksh) both the SIGINT (2)
and EXIT (0) traps are activated, showing a double 'make done'
message. The exit status also wasn't > 128 to indicate a signal.

bin/package, src/cmd/INIT/package.sh:
- Be UNIXly well-behaved. Signals should be passed on after
  handling, so when one is caught, make the trap handlers print
  their message and then unset both itself and EXIT/0 before
  resending the signal to self.
This commit is contained in:
Martijn Dekker 2021-03-17 10:09:57 +00:00
parent 44438725b1
commit 82c6922330
2 changed files with 10 additions and 4 deletions

View file

@ -3999,9 +3999,12 @@ capture() # file command ...
note $action output captured in $o
s="$command: $action start at `date` in $INSTALLROOT"
case $quiet in
0) trap "echo \"$command: $action done at \`date\`\" in $INSTALLROOT 2>&1 | \$TEE -a $o" 0 1 2 ;;
*) trap "echo \"$command: $action done at \`date\`\" in $INSTALLROOT >> $o" 0 1 2 ;;
0) cmd="echo \"$command: $action done at \`date\`\" in $INSTALLROOT 2>&1 | \$TEE -a $o" ;;
*) cmd="echo \"$command: $action done at \`date\`\" in $INSTALLROOT >> $o" ;;
esac
trap "$cmd" 0
trap "$cmd; trap 1 0; kill -1 $$" 1
trap "$cmd; trap 2 0; kill -2 $$" 2
;;
esac
case $quiet in

View file

@ -3999,9 +3999,12 @@ capture() # file command ...
note $action output captured in $o
s="$command: $action start at `date` in $INSTALLROOT"
case $quiet in
0) trap "echo \"$command: $action done at \`date\`\" in $INSTALLROOT 2>&1 | \$TEE -a $o" 0 1 2 ;;
*) trap "echo \"$command: $action done at \`date\`\" in $INSTALLROOT >> $o" 0 1 2 ;;
0) cmd="echo \"$command: $action done at \`date\`\" in $INSTALLROOT 2>&1 | \$TEE -a $o" ;;
*) cmd="echo \"$command: $action done at \`date\`\" in $INSTALLROOT >> $o" ;;
esac
trap "$cmd" 0
trap "$cmd; trap 1 0; kill -1 $$" 1
trap "$cmd; trap 2 0; kill -2 $$" 2
;;
esac
case $quiet in