pub struct Shell {
pub workspace: Arc<dyn Workspace>,
pub launcher: Launcher,
pub live: Option<Live>,
pub spill: Option<Spill>,
pub cut: Option<OutputLimit>,
pub confine: bool,
pub max_timeout: u64,
pub quiet: Duration,
}Expand description
Runs a command with sh -c in its own session and process group, in its
Workspace, as its Launcher starts processes. Its stdout and
stderr come back interleaved line by line, as each line ends, without
terminal escape sequences such as colours; output past the
OutputLimit keeps its first and last lines and the first and last
errors and failures from between. Publishes how the
command ended (ExitStatus) beside its output, and how the output was
cut (OutputCut) when it was, and reports the output
as it comes to its Live, if it has one.
Fields§
§workspace: Arc<dyn Workspace>Where the command runs.
launcher: LauncherHow the command is started: a wrapper, a directory, its variables.
live: Option<Live>Where each piece of output is reported as it comes, before the command ends.
spill: Option<Spill>Where output that is cut is kept whole, named in the cut output.
cut: Option<OutputLimit>How much of the output the result keeps; None keeps all of it, up
to the 10 MB the command is killed at, for a host that cuts output
itself.
confine: boolWhether a cwd that resolves outside the launcher’s directory is
refused. What the command itself does is not confined: it may still
cd anywhere.
max_timeout: u64The most seconds a call may ask for in timeout_secs; a longer
timeout is cut to it.
quiet: DurationHow long a call with the default timeout may print nothing before
it is stopped, such as a loop that never ends; one that names its
timeout_secs may be quiet as long as that.
Implementations§
Source§impl Shell
impl Shell
Sourcepub async fn run(&self, args: ShellArgs) -> Result<ShellRun, ToolExecutionError>
pub async fn run(&self, args: ShellArgs) -> Result<ShellRun, ToolExecutionError>
Runs args as the tool does, waiting on a thread of its own, and
returns the output and how the command ended. Dropping the future
stops the command’s process group at once: SIGTERM, then
SIGKILL after STOP_GRACE.
Trait Implementations§
Source§impl Default for Shell
impl Default for Shell
Source§fn default() -> Self
fn default() -> Self
Started on this machine as this process starts it, nothing spilled
or reported live, output cut as OutputLimit::default cuts it, timeouts
of at most ten minutes, stopped after a minute of printing nothing
unless the call names its timeout.
Source§impl Tool for Shell
impl Tool for Shell
Source§type Error = ToolExecutionError
type Error = ToolExecutionError
Source§fn description(&self) -> String
fn description(&self) -> String
Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
Source§fn annotations(&self) -> ToolAnnotations
fn annotations(&self) -> ToolAnnotations
ToolAnnotations).