make test: properly handle ctrl-c
[vpp.git] / test / scripts / setsid_wrapper.sh
1 #!/bin/bash
2
3 if [[ "$1" == "1" ]]
4 then
5         setsid scripts/run_in_venv_with_cleanup.sh $*
6         pid=$!
7 else
8         setsid scripts/run_in_venv_with_cleanup.sh $* &
9         pid=$!
10         trap "echo setsid_wrapper.sh: got signal, killing child pid ${pid}; kill ${pid}; sleep .1;" SIGINT SIGTERM
11         wait
12 fi