fix(tmux): KillPaneProcesses must kill pane process itself, not just descendants
Claude Code has no descendants, so only killing descendants left orphans. Now kills the pane PID itself with SIGTERM+SIGKILL after descendants. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -293,6 +293,7 @@ func getAllDescendants(pid string) []string {
|
|||||||
// 3. Send SIGTERM to all descendants (deepest first)
|
// 3. Send SIGTERM to all descendants (deepest first)
|
||||||
// 4. Wait 100ms for graceful shutdown
|
// 4. Wait 100ms for graceful shutdown
|
||||||
// 5. Send SIGKILL to any remaining descendants
|
// 5. Send SIGKILL to any remaining descendants
|
||||||
|
// 6. Kill the pane process itself
|
||||||
//
|
//
|
||||||
// This ensures Claude processes and all their children are properly terminated
|
// This ensures Claude processes and all their children are properly terminated
|
||||||
// before respawning the pane.
|
// before respawning the pane.
|
||||||
@@ -323,6 +324,12 @@ func (t *Tmux) KillPaneProcesses(pane string) error {
|
|||||||
_ = exec.Command("kill", "-KILL", dpid).Run()
|
_ = exec.Command("kill", "-KILL", dpid).Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Kill the pane process itself (may have called setsid() and detached,
|
||||||
|
// or may have no children like Claude Code)
|
||||||
|
_ = exec.Command("kill", "-TERM", pid).Run()
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
_ = exec.Command("kill", "-KILL", pid).Run()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user