pub struct Command {
pub program: String,
pub args: Vec<String>,
pub working_dir: Option<String>,
pub env: Vec<(String, String)>,
pub timeout_secs: Option<u64>,
}Expand description
A command to execute in a sandbox.
Commands are built using a fluent builder API and can be converted to shell strings for execution.
Fields§
§program: StringThe program/executable to run.
args: Vec<String>Arguments to pass to the program.
working_dir: Option<String>Working directory for command execution.
If None, uses the sandbox’s default working directory.
env: Vec<(String, String)>Environment variables to set for this command.
These are merged with (and override) the sandbox’s environment.
timeout_secs: Option<u64>Maximum execution time in seconds.
If the command runs longer, it will be terminated.
Implementations§
Source§impl Command
impl Command
Sourcepub fn working_dir(self, dir: impl Into<String>) -> Self
pub fn working_dir(self, dir: impl Into<String>) -> Self
Sets the working directory for command execution.
Sourcepub fn timeout(self, secs: u64) -> Self
pub fn timeout(self, secs: u64) -> Self
Sets the execution timeout in seconds.
Commands exceeding this limit will be terminated.
Sourcepub fn to_shell_string(&self) -> String
pub fn to_shell_string(&self) -> String
Converts the command to a shell-executable string.
The program and arguments are properly escaped for shell execution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more