Stop hook timeout does not kill child process tree
Bug description
When a Stop hook spawns a child process (e.g., Start-Process in PowerShell), Claude Code waits for the entire process tree to finish, ignoring the configured timeout value.
Reproduction steps
- Configure a Stop hook in
~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "powershell -ExecutionPolicy Bypass -File \"some-script.ps1\"",
"timeout": 15
}
]
}
]
}
}
- The script spawns a child process (e.g., calling
claude -p --model haikufor session summarization):
Start-Process -FilePath "powershell" -ArgumentList $args -NoNewWindow
- End a Claude Code session (Ctrl+C or
/exit)
Expected behavior
Claude Code should respect the timeout value (15s in this case), kill the hook process and its children, then exit cleanly.
Actual behavior
Claude Code hangs for 15+ minutes after the session ends, waiting for the child process (claude -p --model haiku) to complete. The timeout appears to have no effect on the child process tree.
Workaround
Use -WindowStyle Hidden instead of -NoNewWindow in the hook script to detach child processes from the parent's process tree. This way the hook script exits immediately and Claude Code doesn't wait.
Environment
- OS: Windows 11
- Shell: PowerShell
- Claude Code: latest (as of Feb 2026)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗