Skip to main content

Module shell

Module shell 

Source
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. 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§

PersistentShellSession
Persistent bash session. Executes are serialized by an internal lock, matching a single terminal.