Ensure validator process is kill when stdout/stderr are redirected (#5179) (#5190)

automerge
This commit is contained in:
mergify[bot]
2019-07-18 22:01:05 -07:00
committed by Grimes
parent 2cada71151
commit 01ebbe367a

View File

@ -371,13 +371,14 @@ PS4="$(basename "$0"): "
pid=
kill_fullnode() {
# Note: do not echo anything from this function to ensure $pid is actually
# killed when stdout/stderr are redirected
set +ex
if [[ -n $pid ]]; then
declare _pid=$pid
pid=
echo "killing pid $_pid"
kill "$_pid" || true
wait "$_pid" || true
echo "$_pid killed"
fi
}
trap 'kill_fullnode' INT TERM ERR