Skip to main content

Module spawn_env

Module spawn_env 

Source
Expand description

SpawnEnv — the typed seam an embedder (mado) uses to stamp its OWN capability env + working directory onto every child PTY tear spawns, applied AFTER the backend’s inherited + fallback env.

Why this exists (operator report 2026-06-12: “vim is grey + wrong font in the embedded-tear default window”): tear-core’s InProcess::spawn_pty_for inherits the daemon/process env and stamps conservative fallbacks (TERM=xterm-256color, no TERMINFO). The embedder (mado) advertises a richer capability set (TERM=xterm-ghostty + a vendored TERMINFO + COLORTERM) that the local-PTY path already projected — but the embedded-tear spawn had no way to push those through, so vim there saw no truecolor (grey) + the wrong terminfo. SpawnEnv is that channel: the embedder hands tear a typed override set, tear applies it AFTER the inherited env so the embedder’s TERM wins over the fallback, and also stamps PWD consistently with the cwd (so a child shell can never inherit a stale parent PWD).

The override is OURS, not the backend’s: tear does not invent these values. It carries the embedder’s intent verbatim. This keeps tear-core agnostic about WHAT capabilities the embedder advertises while still letting the embedder be the source of truth.

Structs§

SpawnEnv
A typed env + cwd override an embedder stamps on every child PTY. Applied by the spawn backend AFTER the inherited + fallback env, so each (key, value) here OVERRIDES whatever the backend defaulted.