pub struct Process { /* private fields */ }
Expand description
Offers an API similar to std::process::Child
.
When dropping, attempts termination and cleanup.
Implementations§
Source§impl Process
impl Process
Sourcepub fn spawn(command: Command) -> Result<Process>
pub fn spawn(command: Command) -> Result<Process>
Spawns a new process as specified by command.
Sourcepub fn wait(&mut self) -> Result<WaitStatus>
pub fn wait(&mut self) -> Result<WaitStatus>
Wait until the process completes, and return it’s status.
Examples found in repository?
examples/shell.rs (line 15)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let d = current_dir().unwrap();
5
6 let rootfs = d.join("rootfs/");
7 let writedir = d.join("write/");
8
9 std::fs::create_dir_all(&writedir)?;
10
11 let mut child = isolated::Command::new(rootfs, "/bin/sh")
12 .disk_write_to(writedir)
13 .spawn()?;
14
15 child.wait()?;
16 Ok(())
17}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Process
impl RefUnwindSafe for Process
impl Send for Process
impl Sync for Process
impl Unpin for Process
impl UnwindSafe for Process
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