pub struct CommandBuilder { /* private fields */ }Expand description
A guest command being assembled — see Sandbox::command.
Implementations§
Source§impl CommandBuilder
impl CommandBuilder
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set a per-command environment variable (-e K=V).
Sourcepub fn cwd(self, cwd: impl Into<String>) -> Self
pub fn cwd(self, cwd: impl Into<String>) -> Self
Run in a working directory (emulated: cd, then exec the real argv).
Sourcepub fn stdin(self, data: impl AsRef<[u8]>) -> Self
pub fn stdin(self, data: impl AsRef<[u8]>) -> Self
Pipe bytes (or a string) to the command’s stdin.
Sourcepub fn log_level(self, level: u32) -> Self
pub fn log_level(self, level: u32) -> Self
bsdkrun’s global --log-level for this call (default 0 — quiet).
Sourcepub fn run(self) -> Result<ExecResult>
pub fn run(self) -> Result<ExecResult>
Run the command to completion and capture the result.
A non-zero exit is data, not an error — chain
ExecResult::ok_or_err when it should be one.
Trait Implementations§
Source§impl Clone for CommandBuilder
impl Clone for CommandBuilder
Source§fn clone(&self) -> CommandBuilder
fn clone(&self) -> CommandBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CommandBuilder
impl RefUnwindSafe for CommandBuilder
impl Send for CommandBuilder
impl Sync for CommandBuilder
impl Unpin for CommandBuilder
impl UnsafeUnpin for CommandBuilder
impl UnwindSafe for CommandBuilder
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