a73x

6643cd87

test: a piped mux hands back the shell's own exit code

a73x   2026-08-28 19:53

Commit message
test: a piped mux hands back the shell's own exit code

The invariant says a piped `mux` exits with the shell's status because
scripts read it, and every pipe_waitexit in the suite but one wanted the
default 0 — which a client that invented its own code satisfies just as
well. The session-a lifetime leg now exits 7.

test/e2e_05_session.sh
Old New
@@ -142,9 +142,16 @@ fi
142 # every one of those deaths (decision 8). This client attaches to a session 142 # every one of those deaths (decision 8). This client attaches to a session
143 # that ALREADY EXISTS — attach-or-create's join arm, the other half of the 143 # that ALREADY EXISTS — attach-or-create's join arm, the other half of the
144 # two creations above — and types the exit that ends it. 144 # two creations above — and types the exit that ends it.
145 #
146 # `exit 7`, not `exit`: a PIPED mux is a wall of one and hands the shell's
147 # own status back, because scripts read it. Every other pipe_waitexit in
148 # this suite wants the default 0, which a client that invented its own code
149 # would satisfy just as well; seven is a number only the shell can be the
150 # source of. (128 is pinned too, on a SIGKILLed shell, in the hosts group —
151 # this is the ordinary path.)
145 pipe_mux "$OUT.m18ax" "$OUT.m18ax.err" timeout 40 "$MUX" --sock "$SOCK21" --session a 152 pipe_mux "$OUT.m18ax" "$OUT.m18ax.err" timeout 40 "$MUX" --sock "$SOCK21" --session a
146 pipe_send 'exit\n' 153 pipe_send 'exit 7\n'
147 pipe_waitexit "M18: the client of an exiting session" 154 pipe_waitexit "M18: a piped mux carries the shell's own exit code" 7
148 155
149 wait_sessions "$SOCK21" 2 "M18: session a's shell exited" 156 wait_sessions "$SOCK21" 2 "M18: session a's shell exited"
150 157