singed
singed copied to clipboard
CLI should trap signals and pass them on to processes
trafficstars
I am trying to profile bin/rails server backgrounded in a script, and then kill it at the end. When I go to kill it, it seems to only kill the singed process, and rbspy that it is calling.
cleanup() {
local pids
pids=$(jobs -pr)
if [ -n "$pids" ]; then
echo "Killing processes: $pids"
kill $pids
fi
}
trap "cleanup" SIGINT SIGTERM EXIT
echo "Starting server"
bin/rails server &
I'm not sure if rbspy is smart enough to be able to dump its progress or not, but at least trapping and passing it on would be a good first step