blob: 030c3b079de730b6ef1efcdd227b868ba7a248c9 [file] [log] [blame]
#!/bin/bash
cmd=$1
force_foreground=$2
shift
shift
if [[ "$force_foreground" == "1" ]]
then
setsid $cmd $force_foreground $*
else
setsid $cmd $force_foreground $* &
pid=$!
trap "echo setsid_wrapper.sh: got signal, killing child pid ${pid}; kill ${pid}; sleep .1;" SIGINT SIGTERM
wait ${pid}
exit $?
fi