Expand description
§Terminal handlers
Two related responsibilities:
Terminal*- operate on PTYs that are already registered via theTerminalProvidertrait. Every method takes a provider-assignedterminal_id(u64).LocalPTY*- read-only platform queries that don’t touch any registered PTY: discover available shells, default shell, and the current process environment.
Layout (one export per file, file name = identity):
TerminalCreate::TerminalCreate,TerminalSendText::TerminalSendText,TerminalDispose::TerminalDispose,TerminalShow::TerminalShow,TerminalHide::TerminalHide.LocalPTYGetProfiles::LocalPTYGetProfiles,LocalPTYGetDefaultShell::LocalPTYGetDefaultShell,LocalPTYGetEnvironment::LocalPTYGetEnvironment.
Modules§
- LocalPTY
GetDefault Shell - Pick the system default shell. Unix:
$SHELL, then probe/bin/{zsh,bash,sh}. Windows: PowerShell 7 if installed, else stock Windows PowerShell. Used by Wind’s “Open Default Terminal” command and by extensions that spawn unparented shells. - LocalPTY
GetEnvironment - Snapshot the Mountain process environment as a
HashMap. Inherited by every PTY spawned throughTerminalCreate. Includes the keys merged in byEnhanceShellEnvironmentat boot, so a Finder-launched.appexposes the user’s interactive shell PATH / NVM_DIR / HOMEBREW_PREFIX / … to terminals it spawns. - LocalPTY
GetProfiles - Discover available terminal profiles. Probes every well-
known shell location plus
/etc/shells(Unix) or known Windows install paths. The first existing match flagsisDefault=true; on Unix the user’s$SHELLwins. - Terminal
Create - Spawn a new PTY through
TerminalProvider::CreateTerminal.Optionscarries shell path, args, cwd, env, name. Returns a provider-assigned terminal id (u64) which Wind uses for every subsequent send/show/dispose call. - Terminal
Dispose - Close a PTY, kill its child, and drop the entry from the provider’s terminal registry. Idempotent - disposing an already-disposed id surfaces as a logged warning, not an error.
- Terminal
Hide - Hide a terminal panel without disposing the underlying PTY.
The child process keeps running; subsequent
TerminalShowreopens the same session. Mirrorsvscode.Terminal.hide(). - Terminal
Send Text - Pipe text into a terminal’s PTY stdin. Used both for direct
key forwarding (xterm.js → Mountain → PTY) and for
programmatic input (
vscode.window.terminals[…].sendText). - Terminal
Show - Bring a terminal to the foreground in the panel. When
PreserveFocusistrue, the active editor keeps keyboard focus (mirrorsvscode.Terminal.show(preserveFocus)).