Ensure validator process is kill when stdout/stderr are redirected (#5179)
This commit is contained in:
parent
a12e7a2e33
commit
cdbd1b908a
|
@ -371,13 +371,14 @@ PS4="$(basename "$0"): "
|
||||||
|
|
||||||
pid=
|
pid=
|
||||||
kill_fullnode() {
|
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
|
if [[ -n $pid ]]; then
|
||||||
declare _pid=$pid
|
declare _pid=$pid
|
||||||
pid=
|
pid=
|
||||||
echo "killing pid $_pid"
|
|
||||||
kill "$_pid" || true
|
kill "$_pid" || true
|
||||||
wait "$_pid" || true
|
wait "$_pid" || true
|
||||||
echo "$_pid killed"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
trap 'kill_fullnode' INT TERM ERR
|
trap 'kill_fullnode' INT TERM ERR
|
||||||
|
|
Loading…
Reference in New Issue