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 stdout(self, writer: impl Write + Send + 'static) -> Self
pub fn stdout(self, writer: impl Write + Send + 'static) -> Self
Stream stdout to writer while retaining it in the returned result.
Sourcepub fn stderr(self, writer: impl Write + Send + 'static) -> Self
pub fn stderr(self, writer: impl Write + Send + 'static) -> Self
Stream stderr to writer while retaining it in the returned result.
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.
Auto Trait Implementations§
impl !RefUnwindSafe for CommandBuilder
impl !Sync for CommandBuilder
impl !UnwindSafe for CommandBuilder
impl Freeze for CommandBuilder
impl Send for CommandBuilder
impl Unpin for CommandBuilder
impl UnsafeUnpin 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