Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/axl-runtime/src/engine/std/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,27 @@ pub(crate) fn command_methods(registry: &mut MethodsBuilder) {
Ok(this)
}

/// Executes the command as a child process, returning a handle to it.
///
/// By default, stdin, stdout and stderr are inherited from the parent.
fn spawn<'v>(#[allow(unused)] this: values::Value<'v>) -> anyhow::Result<Child> {
let cmd = this.downcast_ref_err::<Command>()?;
let child = cmd.inner.borrow_mut().spawn()?;
Ok(Child {
inner: Rc::new(RefCell::new(Some(child))),
})
}

/// Executes a command as a child process, waiting for it to finish and collecting its status.
/// Unlike `cmd.spawn().wait()` and `cmd.spawn().wait_with_output()`, this function does not
/// close the stdin handle.
///
/// By default, stdin, stdout and stderr are inherited from the parent.
fn status<'v>(#[allow(unused)] this: values::Value<'v>) -> anyhow::Result<ExitStatus> {
let cmd = this.downcast_ref_err::<Command>()?;
let status = cmd.inner.borrow_mut().status()?;
Ok(ExitStatus(status))
}
}

#[derive(Debug, Display, Trace, ProvidesStaticType, NoSerialize, Allocative)]
Expand Down
15 changes: 15 additions & 0 deletions docs/lib/std/process/command.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.