In a freestyle job, the build phase has the following script:

#!/bin/bash
trap 'echo "Death by SIGTERM"; kill $pid; exit 15;' SIGTERM
sleep 10 & pid=$!
echo "Waiting"
wait $pid
echo "Exit status: $?"


When this is aborted with the UI [x] red box, the message "Death by 
SIGTERM" never appears, but the exit code reflects the abort by printing 
"Exit status: 143"

How can I get the trap to be executed? I already tried export 
BUILD_ID=dontKillMe, I already tried setting it as a parameter of the 
build, and I already tried injecting it with the env inject plugin: it does 
not work.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to