fix(jobs): subshell-guard exit/exec so the sentinel always prints - #46
Merged
Conversation
A command containing exit or exec as a word terminated or replaced the pane shell before the appended sentinel printf ran. The sentinel then existed nowhere — not in the pane, not in the pipe-pane log — so the log-fallback from #29 could not help and the job sat 'running' until its full timeout (sidemux-6e2; observed live with a 360s wait on a finished 90s job). Just those commands are now wrapped in a posix subshell before the suffix is appended: exit/exec end the subshell, the outer shell survives to print the sentinel, and the exit code passes through unchanged (( exit 7 ) is 7). As a bonus the pane now survives and reports the real code where it previously died with status unknown. fish is left unwrapped (no subshell operator); a fish exit closes the pane, which pane-death handling already settles. Closes sidemux-6e2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes beads issue sidemux-6e2.
Problem
A command containing
exitorexecas a word terminates (or replaces) the pane's shell before the appended; printf '<<SMUX…>>'sentinel runs. The sentinel then exists nowhere — not in the pane, not in the pipe-pane log — so the #29 log fallback can't help, and the job reportsrunninguntil its full timeout. Observed live: a 360s wait burned on a job that finished in ~90s (grep -c SMUX <log>= 0).Fix
buildLaunchBodywraps only commands matchingexit/execas a word in a posix subshell:exit/execend the subshell; the outer shell survives to print the sentinel.( exit 7 )→ 7).unknownwith no code.exitclosing the pane is settled by pane-death handling.cd/env changes don't persist in the pane.Detection-based alternatives (settle when the shell is childless and quiet) were rejected: they false-settle pure-builtin loops and bare
readprompts.Tests
pnpm run exit-lint,echo \"exit\"stay unwrapped; fish never wraps).echo pre-exit-probe; exit 7settlesstatus=exit, code 7, pane intact — this exact case previously ran to wait-timeout.unknown/dead-pane behavior to the new, strictly better outcome.Full gate green (typecheck, lint, test, build).