pub struct Command { /* private fields */ }Expand description
A program to run.
Implementations§
Source§impl Command
impl Command
Sourcepub fn new(program: impl Into<String>) -> Command
pub fn new(program: impl Into<String>) -> Command
A program by name (looked up in each directory of PATH, default
/bin, as NAME.wasm and then NAME) or by path (when it contains
a /). Disks are searched in order: this program’s own, the boot
disk, then the rest, unless Command::disk picks one.
Sourcepub fn from_image(name: impl Into<String>, image: impl Into<Vec<u8>>) -> Command
pub fn from_image(name: impl Into<String>, image: impl Into<Vec<u8>>) -> Command
A program from a wasm binary in memory. name is its argv[0].
pub fn arg(&mut self, arg: impl Into<String>) -> &mut Command
pub fn args<I: IntoIterator<Item = S>, S: Into<String>>( &mut self, args: I, ) -> &mut Command
pub fn env( &mut self, key: impl Into<String>, value: impl Into<String>, ) -> &mut Command
pub fn envs<I: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>>( &mut self, vars: I, ) -> &mut Command
pub fn env_remove(&mut self, key: impl Into<String>) -> &mut Command
Sourcepub fn env_clear(&mut self) -> &mut Command
pub fn env_clear(&mut self) -> &mut Command
Start from an empty environment instead of this program’s.
Sourcepub fn disk(&mut self, disk: impl Into<Address>) -> &mut Command
pub fn disk(&mut self, disk: impl Into<Address>) -> &mut Command
Load the program from this filesystem only.
Sourcepub fn current_dir(&mut self, dir: impl AsRef<Path>) -> &mut Command
pub fn current_dir(&mut self, dir: impl AsRef<Path>) -> &mut Command
Runs the child in dir instead of this program’s current directory.
A relative dir starts at the current directory. A relative program
path (./tool.wasm) is looked up from the child’s directory.
pub fn get_current_dir(&self) -> Option<&Path>
pub fn get_program(&self) -> &str
pub fn get_args(&self) -> &[String]
Sourcepub fn status(&mut self) -> Result<ExitStatus>
pub fn status(&mut self) -> Result<ExitStatus>
Runs the program with this program’s stdin and stdout, and waits for it.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Command
impl Freeze for Command
impl Move 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