Merge pull request 'fix: claude subprocess not killed on INT/TERM in cleanup trap (#530)' (#679) from fix/issue-530 into master
This commit is contained in:
commit
f1b64a448f
1 changed files with 8 additions and 1 deletions
|
|
@ -180,8 +180,12 @@ SNAP=$("$CAST" rpc anvil_snapshot --rpc-url "$RPC_URL" | tr -d '"')
|
|||
log " Snapshot ID: $SNAP"
|
||||
|
||||
# Revert to the baseline snapshot on exit so subsequent runs start clean.
|
||||
CLAUDE_PID=""
|
||||
cleanup() {
|
||||
local rc=$?
|
||||
if [[ -n "${CLAUDE_PID:-}" ]]; then
|
||||
kill "$CLAUDE_PID" 2>/dev/null || true
|
||||
fi
|
||||
if [[ -n "${SNAP:-}" ]]; then
|
||||
"$CAST" rpc anvil_revert "$SNAP" --rpc-url "$RPC_URL" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
|
@ -661,8 +665,11 @@ set +e
|
|||
# omitting it causes the CLI to exit with an error, producing an empty stream log.
|
||||
timeout "$CLAUDE_TIMEOUT" claude -p --dangerously-skip-permissions \
|
||||
--verbose --output-format stream-json \
|
||||
"$PROMPT" >"$STREAM_LOG" 2>&1
|
||||
"$PROMPT" >"$STREAM_LOG" 2>&1 &
|
||||
CLAUDE_PID=$!
|
||||
wait "$CLAUDE_PID"
|
||||
AGENT_EXIT=$?
|
||||
CLAUDE_PID=""
|
||||
set -e
|
||||
|
||||
if [[ $AGENT_EXIT -ne 0 ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue