Expand description
Persistent shell session — the reference [ShellSession] implementation
behind the coding-omp-v1 “Shell session” extension.
Protocol: one long-lived bash --noprofile --norc child with piped
stdio. Each [ShellSession::execute] writes the command followed by an
exit-code marker line and reads stdout until the marker, so the working
directory and exported environment persist across calls.
Cancellation: the child runs in its own process group and installs a
no-op trap : INT. [ShellSession::cancel] SIGINTs the whole group —
bash swallows the signal (trap) and survives to run the marker line,
while the foreground command inherits the DEFAULT disposition and dies,
surfacing as exit code 130. The session init also merges stderr into
stdout (exec 2>&1), so command diagnostics arrive in one stream.
Output is bounded; the bound is reported via ShellOutput::truncated.
Known edge (documented, same class as OMP): a command that consumes stdin itself will swallow the marker line — such commands should read from files/args, not the session’s stdin.
Structs§
- Persistent
Shell Session - Persistent bash session. Executes are serialized by an internal lock, matching a single terminal.