macOS: keep pane programs running across daemon restarts (an FD store without systemd) #18
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
On Linux, restarting or upgrading
illogicaldleaves every pane's program running (M2b): each pane runs in its own systemd scope, and its PTY master waits in systemd's FD store until the new daemon takes it back. macOS has neither, so on a Mac a daemon restart ends every program running in a pane.What happens today (seen on jake-mini, 2026-10-01)
launchctl kickstart -k gui/$UID/illogicaldwith two panes: a shell that had runcd /tmp && echo before-restart-42, and a pane runningsleep 600.── restored <time> ──.sleep 600pane got a fresh shell (default policy); the sleep was not rerun.That's the restart policy doing its job, but it's the pre-M2b experience: any upgrade or crash on the Mac costs you every running shell, editor, build and agent.
Why
Nothing keeps a pane's PTY master open while the daemon is gone. When the daemon exits, the master closes, the terminal hangs up, and the programs on it get SIGHUP. launchd has no FD store, and the daemon starts panes without scopes there (
Launcher { scopes: false, fd_store: false }).Sketch: a holder that outlives the daemon
Something other than the daemon must own the masters across a restart, and hand them back.
illogicald _shim) already outlives the daemon and records the program's exit. Let it also keep a copy of the master, and listen on a per-pane Unix socket in the state dir. A new daemon connects and receives the master withSCM_RIGHTS, likeLISTEN_FDStoday. The cost is one small process per pane, which already exists.illogicald _holderstarted by the daemon (or as its own launchd agent) that keeps all masters and hands them over on request. That's fewer processes, but one more thing to supervise and upgrade.AbandonProcessGroupand the job's kill semantics, sokickstart -kand a crash don't take them down. Run them in their own session (they alreadysetsid).stop(logout,launchctl bootout) should still end the panes, assystemctl --user stopdoes on Linux; only restart and upgrade keep them.Done when
launchctl kickstart -k gui/$UID/illogicald(and installing a new build) leaves vim and a running build untouched, and clients reconnect on their own, as M2b's done-when says for Linux.kill -9) on a Mac also keeps the panes' programs running.launchctl bootout(and logging out) still ends them.Done in
e9704b5(the merge ofbc6a443) and rolled out to jake-mini. There,launchctl kickstart -k,kill -9andillogicald install(an upgrade) keep pane programs running with no lost output, andlaunchctl bootoutends them after a minute. Linux hosts without systemd get the same with--keep-panes.