diff --git a/MODULE.aspect b/MODULE.aspect index d204f69bd..2308980f7 100644 --- a/MODULE.aspect +++ b/MODULE.aspect @@ -13,7 +13,7 @@ axl_local_dep( axl_archive_dep( name = "aspect_rules_lint", urls = ["https://github.com/aspect-build/rules_lint/archive/65525d871f677071877d3ea1ec096499ff7dd147.tar.gz"], - integrity = "sha512-TGcxutWr8FwxrK3G+uthbEpuYM2oOVpHPOvaVPzLLuHkfPY0jn/GWFp9myQeFzDFsRZ4ilT0jAWfGZhTk/nesQ==", + integrity = "sha512-TGcxutWr8FwxrK3G+uthbEpuYM2oOVpHPOvaVPzLLuHkfPY0jn/GWFp9myQeFzDFsRZ4ilT0jAWfGZhTk/nesQ== sha512-IKsrPMgaNuzHAkHzyKbJexzt8ObepFhtzyurirppI1XNHgMKrLMuPXXVFeOpoVws5o2EMUSY4ZisCz9SLFKbhg==", strip_prefix = "rules_lint-65525d871f677071877d3ea1ec096499ff7dd147", auto_use_tasks = True, dev = True, diff --git a/crates/axl-runtime/src/engine/std/process.rs b/crates/axl-runtime/src/engine/std/process.rs index 792b1c8e3..3160ad045 100644 --- a/crates/axl-runtime/src/engine/std/process.rs +++ b/crates/axl-runtime/src/engine/std/process.rs @@ -178,6 +178,9 @@ 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 { let cmd = this.downcast_ref_err::()?; let child = cmd.inner.borrow_mut().spawn()?; @@ -185,6 +188,17 @@ pub(crate) fn command_methods(registry: &mut MethodsBuilder) { 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 { + let cmd = this.downcast_ref_err::()?; + let status = cmd.inner.borrow_mut().status()?; + Ok(ExitStatus(status)) + } } #[derive(Debug, Display, Trace, ProvidesStaticType, NoSerialize, Allocative)]