Restoring a session
sess open rebuilds the session window by window:
tmux new-sessionfor the first window, in the first pane's saved working directory.tmux split-windowonce per additional saved pane.tmux select-layoutwith the exact layout string captured at save time, so the geometry matches precisely instead of an even/generic split.- If the snapshot has any persisted environment variables,
export NAME=valueis sent into every pane's shell first — each pane is a separate process, so a var exported in one pane never reaches the others on its own. tmux send-keysto relaunch each pane's saved command — guarded with--so a command that happens to start with-is never misread as a flag.
If a live tmux session with the target name already exists, sess refuses
to restore over it and attaches instead (see open
for the --force override).
Restoring relaunches commands from scratch — it does not preserve a process's internal memory state (variables loaded in a REPL, for example). See Limitations.
Attaching, for real
Handing control of the terminal back to tmux for an interactive attach
needs the child process to inherit the real stdin/stdout/stderr, not have
them captured into a pipe — sess uses Command::status() for this one
call specifically (Command::output(), used everywhere else for its
convenient error capture, would silently break interactive attach).