Problem statement
In tmux, when a pane's child process exits and remain-on-exit is enabled, the pane stays on screen in a "dead" state and hooks such as pane-died (and related events) still run. Automation and plugins often depend on that—for example a pane-died hook that runs respawn-pane after checking #{pane_dead}.
In psmux, pane-died / pane-exited hooks appear to run only when the reaper removes a pane from the layout. If remain-on-exit is on, the child exits but the pane node may stay, so no prune occurs and the hooks may never fire. That breaks workflows and external tests that assume tmux-like behavior.
Commands to reproduce
display-message is shown on an attached client (status / message area). A detached session often has no client, so you will not see the message until you attach—or use a side effect that does not need a TUI.
A. See display-message (requires a client)
- Start a detached session whose pane exits quickly:
psmux new-session -d -s repro-session -n test "Start-Sleep -Seconds 2"
- Set
remain-on-exit and a pane-died hook:
psmux set-option -t repro-session -g remain-on-exit on
psmux set-hook -t repro-session pane-died 'display-message "PANE-DIED-FIRED"'
- Attach so messages are visible:
psmux attach -t repro-session
-
Wait until the initial Start-Sleep has finished (at least ~3 seconds after step 1, or wait after attach if you attached late).
-
Expected (tmux-like): shortly after the pane's process exits, you should see PANE-DIED-FIRED in the message/status area. Actual: that message may never appear even though the pane is dead with remain-on-exit.
Detach when finished (e.g. prefix + d, or your documented detach command).
B. Observe without relying on the UI (detached-friendly)
psmux set-hook -t repro-session pane-died 'run-shell -b "echo died >> $env:TEMP\psmux-pane-died.txt"'
After the sleep exits, inspect that file for new content.
Optional: repeat the same steps against tmux 3.x with the same session/hook names for comparison.
Acceptance criteria
- When a pane's child process exits and
remain-on-exit is on, pane-died and pane-exited hooks run in line with tmux semantics for that scenario.
- Hooks must not fire repeatedly every idle tick; they should run when the "dead under remain-on-exit" condition is first detected (or match tmux behavior if documented differently).
- Firing hooks for remain-on-exit deaths must not imply removing panes or resizing the layout solely because the pane became dead (resize when the tree structure changes, e.g. a pane is actually removed).
- With
remain-on-exit off, existing behavior for reaping exited panes and firing hooks on removal remains correct.
- Add or extend tests (unit and/or integration) that cover hooks firing when a pane becomes dead with
remain-on-exit; update compatibility docs if the project maintains them.
Problem statement
In tmux, when a pane's child process exits and
remain-on-exitis enabled, the pane stays on screen in a "dead" state and hooks such aspane-died(and related events) still run. Automation and plugins often depend on that—for example apane-diedhook that runsrespawn-paneafter checking#{pane_dead}.In psmux,
pane-died/pane-exitedhooks appear to run only when the reaper removes a pane from the layout. Ifremain-on-exitis on, the child exits but the pane node may stay, so no prune occurs and the hooks may never fire. That breaks workflows and external tests that assume tmux-like behavior.Commands to reproduce
display-messageis shown on an attached client (status / message area). A detached session often has no client, so you will not see the message until you attach—or use a side effect that does not need a TUI.A. See
display-message(requires a client)remain-on-exitand apane-diedhook:Wait until the initial
Start-Sleephas finished (at least ~3 seconds after step 1, or wait after attach if you attached late).Expected (tmux-like): shortly after the pane's process exits, you should see
PANE-DIED-FIREDin the message/status area. Actual: that message may never appear even though the pane is dead withremain-on-exit.Detach when finished (e.g. prefix +
d, or your documented detach command).B. Observe without relying on the UI (detached-friendly)
After the sleep exits, inspect that file for new content.
Optional: repeat the same steps against tmux 3.x with the same session/hook names for comparison.
Acceptance criteria
remain-on-exitis on,pane-diedandpane-exitedhooks run in line with tmux semantics for that scenario.remain-on-exitoff, existing behavior for reaping exited panes and firing hooks on removal remains correct.remain-on-exit; update compatibility docs if the project maintains them.