pub struct ShellSession {
pub id: String,
pub command: String,
pub session_id: Option<String>,
pub environment: CommandEnvironmentDiagnostics,
/* private fields */
}Fields§
§id: String§command: String§session_id: Option<String>Bamboo session id that owns this background shell, if any. Set from the
dispatch context (issue #84, phase 2a) so the registry can be queried
per-session. None means the shell is untagged (e.g. spawned from tests).
environment: CommandEnvironmentDiagnosticsImplementations§
Source§impl ShellSession
impl ShellSession
pub fn status(&self) -> &'static str
pub async fn exit_code(&self) -> Option<i32>
pub async fn read_output_since( &self, cursor: usize, filter: Option<&Regex>, ) -> (Vec<String>, usize, usize)
Sourcepub async fn kill(&self) -> Result<(), String>
pub async fn kill(&self) -> Result<(), String>
Request termination of the background shell. Flips running optimistically
so Self::status reflects the kill immediately, then signals the
completion task (the sole owner of the child handle) to start_kill and
reap. The real exit code + the completion event/push are recorded by that
task when the process is reaped. Never locks the child handle — see
ShellSession::kill_notify.
Sourcepub async fn write_stdin(
&self,
data: &str,
append_newline: bool,
) -> Result<(), String>
pub async fn write_stdin( &self, data: &str, append_newline: bool, ) -> Result<(), String>
Write data to the shell’s retained stdin pipe (issue #89). When
append_newline is true a trailing \n is appended so the input is
delivered as a complete line (e.g. to satisfy a line-oriented prompt).
Returns a clear error — never panics — when the shell was NOT spawned interactive (no stdin pipe to write to) or when the write/flush fails (the process has exited and the pipe is closed). Callers must not treat either case as fatal: a non-interactive shell simply has no stdin, and an exited shell’s pipe is gone.
Sourcepub async fn close_stdin(&self) -> bool
pub async fn close_stdin(&self) -> bool
Close the retained stdin pipe (issue #89), sending end-of-file to the
child. Dropping the ChildStdin handle closes the pipe’s write end, so
a consumer that reads stdin until EOF (e.g. cat, sort, a REPL) can
terminate normally instead of running until killed.
Idempotent: a no-op on a non-interactive shell (stdin was already
None) or one whose stdin was already closed. Returns true when a
handle was actually taken (i.e. this was an interactive shell whose
stdin was still open), false otherwise, so callers can distinguish.