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

@ -84,9 +84,11 @@ while ! $solana_wallet \
sleep 1
done
set -o pipefail
trap 'kill "$pid" && wait "$pid"' INT TERM
$program \
--identity "$SOLANA_CONFIG_DIR"/validator.json \
--testnet "$leader_address:$leader_port" \
--ledger "$SOLANA_LEADER_CONFIG_DIR"/ledger.log \
2>&1 | $validator_logger
> >($validator_logger) 2>&1 &
pid=$!
wait "$pid"