Terminate child process when main script is interrupted

This commit is contained in:
Michael Vines
2018-07-30 14:29:34 -07:00
parent 95b98b3845
commit 647053e973
3 changed files with 13 additions and 6 deletions

View File

@@ -25,8 +25,10 @@ fi
tune_networking
set -xo pipefail
trap 'kill "$pid" && wait "$pid"' INT TERM
$program \
--identity "$SOLANA_CONFIG_DIR"/leader.json \
--ledger "$SOLANA_CONFIG_DIR"/ledger.log \
2>&1 | $leader_logger
> >($leader_logger) 2>&1 &
pid=$!
wait "$pid"