an infinite-canvas terminal multiplexer using gpui

tarpd: keep terminals in holder processes #9

Closed eti.tf
targeting main from eti.tf/tarp:eti/tarpd-holders
Closed opened by and assigned to eti.tf
targeting main from eti.tf/tarp:eti/tarpd-holders

tarpd used to own every pty directly, so stopping or restarting the daemon hung up every terminal.

Each terminal now runs under a holder: the same executable started again in its own session. The holder opens the pty, spawns the command, keeps the master open, and reaps the child. It passes the master to tarpd over a unix socket in <state_dir>/held/, using SCM_RIGHTS.

  • On startup, tarpd connects to every holder it finds, so terminals come back with their ids, positions and processes.
  • Moves go to the holder as they happen. On SIGTERM, SIGINT and daemon.kill, tarpd also hands each holder the screen and title, so the next daemon restores the screen.
  • The systemd unit sets KillMode = "process" so a restart does not kill the holders.

Based on op/kmwmtpnqoxwu.

Tested on NixOS aarch64: tarpd, tarpc and sim tests, plus new tests: a terminal outlives one daemon and the next one takes it over, and a command that ends at once still reports its exit.

Commits 0