From: Gabriel Corona Date: Tue, 25 Aug 2015 07:35:48 +0000 (+0200) Subject: smpirun: Raise the same signal we received X-Git-Tag: v3_12~300^2~8 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c68dee26ad864ff344f4d77da3f2148e164dca0a smpirun: Raise the same signal we received --- diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index e9e2b431ec..18a29d853c 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -69,6 +69,8 @@ HOSTFILETMP=0 unset pid +trapped_signals="HUP INT QUIT ILL ABRT SEGV FPE ALRM TERM USR1 USR2 BUS" + smpirun_cleanup() { if [ -z "${KEEP}" ] ; then @@ -92,17 +94,28 @@ smpirun_cleanup() } smpirun_trap() { + local sig + sig="$1" + + # Cleanup and kill the child process: smpirun_cleanup if ! [ -z "$pid" ]; then kill -TERM $pid fi unset pid - trap - HUP INT QUIT ILL ABRT SEGV FPE ALRM TERM USR1 USR2 BUS + + # Raise the same signal again (remove the traps first): + trap - $trapped_signals + kill -$sig $$ + + # This should never happen: + kill -ABRT $$ kill -TERM $$ - exit 128 } -trap smpirun_trap HUP INT QUIT ILL ABRT SEGV FPE ALRM TERM USR1 USR2 BUS +for s in $trapped_signals; do + trap "smpirun_trap $s" $s +done while true; do case "$1" in