From 25764b9efdc02496874c3db6d1774de34bf08f77 Mon Sep 17 00:00:00 2001 From: John-John Tedro Date: Tue, 16 Mar 2021 08:27:34 +0100 Subject: [PATCH] Update READMEs and tools --- crates/rune-modules/src/process.rs | 18 ++++-------------- crates/rune-ssa/README.md | 3 +++ tools/publish.rn | 2 +- tools/readmes.rn | 2 +- 4 files changed, 9 insertions(+), 16 deletions(-) create mode 100644 crates/rune-ssa/README.md diff --git a/crates/rune-modules/src/process.rs b/crates/rune-modules/src/process.rs index a94ff04d2..9dce405f5 100644 --- a/crates/rune-modules/src/process.rs +++ b/crates/rune-modules/src/process.rs @@ -51,8 +51,6 @@ pub fn module(_stdio: bool) -> Result { module.async_inst_fn("wait_with_output", Child::wait_with_output)?; module.inst_fn(Protocol::STRING_DISPLAY, ExitStatus::display)?; module.inst_fn("code", ExitStatus::code)?; - - module.field_fn(Protocol::INDEX_GET, "status", Output::status)?; Ok(module) } @@ -127,7 +125,7 @@ impl Child { }; Ok(Ok(Output { - status: output.status, + status: ExitStatus { status: output.status }, stdout: Shared::new(Bytes::from_vec(output.stdout)), stderr: Shared::new(Bytes::from_vec(output.stderr)), })) @@ -136,23 +134,15 @@ impl Child { #[derive(Any)] struct Output { - status: std::process::ExitStatus, + #[rune(get)] + status: ExitStatus, #[rune(get)] stdout: Shared, #[rune(get)] stderr: Shared, } -impl Output { - /// Get the exist status of the process. - fn status(&self) -> ExitStatus { - ExitStatus { - status: self.status, - } - } -} - -#[derive(Any)] +#[derive(Clone, Copy, Any)] struct ExitStatus { status: std::process::ExitStatus, } diff --git a/crates/rune-ssa/README.md b/crates/rune-ssa/README.md new file mode 100644 index 000000000..7f8df3a25 --- /dev/null +++ b/crates/rune-ssa/README.md @@ -0,0 +1,3 @@ +# rune-ssa + +The state machine assembler of Rune. diff --git a/tools/publish.rn b/tools/publish.rn index 5801e8048..2fbf452ff 100644 --- a/tools/publish.rn +++ b/tools/publish.rn @@ -17,7 +17,7 @@ pub async fn main() { let status = select { _ = ctrl_c => break, - status = cargo.spawn()? => status?, + output = cargo.spawn()?.wait_with_output() => output?.status, }; println(`${project}: ${status}`); diff --git a/tools/readmes.rn b/tools/readmes.rn index f3aa997d7..db615bb5f 100644 --- a/tools/readmes.rn +++ b/tools/readmes.rn @@ -3,7 +3,7 @@ use process::Command; async fn update_readme(project, output) { let cargo = Command::new("cargo"); cargo.args(["readme", "-r", project, "-o", output, "-t", "../../README.tpl"]); - Ok(cargo.spawn()?.await?) + Ok(cargo.spawn()?.wait_with_output().await?.status) } pub async fn main() {