vpp/test/scripts/setsid_wrapper.sh
Tom Jones c3b416c492 build: Explicitly use bash for shell scripts
VPP requires bash for all shell scripts. Align shebang lines in build
and test scripts to look up the location of bash rather than hard coding
'/bin/bash'.

Look up the location of bash for makefiles.

Type: improvement
Change-Id: I23b705d81d60389fa8af61c680cf0abd74f0ea24
Signed-off-by: Tom Jones <thj@freebsd.org>
2024-01-19 12:30:01 +00:00

18 lines
318 B
Bash
Executable File

#!/usr/bin/env 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