Skip to main content

Module ReviveTerminalProcesses

Module ReviveTerminalProcesses 

Source
Expand description

Revive serialised terminal processes after a window reload.

VS Code calls localPty:reviveTerminalProcesses with the array previously returned by localPty:serializeTerminalState. Each entry describes a shell that was running before the reload; Mountain respawns each one and emits a sky://terminal/create event so the xterm panel re-binds.

§Wire shape (Arguments[0])

[
  {
    "id": 1,
    "shellLaunchConfig": { "executable": "/bin/zsh", "args": [], "cwd": "/Users/..." },
    "processDetails":    { "cwd": "/Users/...", "pid": 1234, "title": "zsh" }
  }
]

Arguments[1] is the locale string used for date formatting in VS Code’s UI; Mountain ignores it.

§Behaviour

  • Each entry is forwarded to TerminalCreate with { shellPath, cwd, name }.
  • The newly allocated terminal ID (assigned by Mountain’s atomic counter) is returned alongside the requested ID so the workbench can remap its internal _ptys table.
  • Entries whose shellLaunchConfig.executable is empty are skipped to avoid spawning a headless PTY that would immediately exit.

Functions§

Fn