pub struct RunningCommand { /* private fields */ }Expand description
A command BashTool::spawn started (spec 3.1 §10 D10).
wait for it to exit, then read its result; or
kill it. Dropping it kills the command’s processes, so a caller that
keeps a command running — a background shell — keeps this value.
Implementations§
Source§impl RunningCommand
impl RunningCommand
Sourcepub fn pid(&self) -> Option<u32>
pub fn pid(&self) -> Option<u32>
The process id of the shell, which leads the command’s process group on Unix; None
when the platform gave none.
Sourcepub async fn wait(&mut self) -> Result<Option<i32>>
pub async fn wait(&mut self) -> Result<Option<i32>>
Waits for the command to exit and its output to end; its exit code, None when a
signal ended it. Cancel-safe: a wait dropped before it returns can be called again.
§Errors
Returns the error from waiting on the process.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether the command has exited and been waited for.
Sourcepub async fn kill_and_wait(&mut self)
pub async fn kill_and_wait(&mut self)
Kills the command’s processes and waits, briefly, for them to be reaped.
Sourcepub fn output_bytes(&self) -> u64
pub fn output_bytes(&self) -> u64
Bytes the command has written to stdout and stderr so far.
Sourcepub fn last_line(&self) -> Option<String>
pub fn last_line(&self) -> Option<String>
The last line the command has written, at most 200 characters.
Sourcepub fn keep_output(&self) -> Result<String>
pub fn keep_output(&self) -> Result<String>
Sends the command’s output to a file from the output store, from its first byte and whatever the result needs, and returns the file’s id.
§Errors
Returns an error when the tool has no output store or the store cannot create the file.