diff --git a/andax/src/fns/io.rs b/andax/src/fns/io.rs index 4a2a4f8..02082aa 100644 --- a/andax/src/fns/io.rs +++ b/andax/src/fns/io.rs @@ -46,6 +46,18 @@ type T = Result<(i32, String, String), Box>; /// We will let rhai handle all the nasty things. #[export_module] pub mod ar { + /// get the return code from the return value of `sh()` + pub fn sh_rc(o: (i32, String, String)) -> i32 { + o.0 + } + /// get stdout from the return value of `sh()` + pub fn sh_stdout(o: (i32, String, String)) -> String { + o.1 + } + /// get stderr from the return value of `sh()` + pub fn sh_stderr(o: (i32, String, String)) -> String { + o.2 + } /// run a command using `cmd` on Windows and `sh` on other systems #[instrument(skip(ctx))]