diff --git a/src/std_fns.rs b/src/std_fns.rs index 3a60f75..8c7d1e6 100644 --- a/src/std_fns.rs +++ b/src/std_fns.rs @@ -812,13 +812,19 @@ pub fn command(stack: &mut Stack) -> OError { if args.is_empty() { return stack.err(ErrorKind::InvalidCall("command".to_owned())); } - process::Command::new(&args[0]) - .args(&args[1..]) - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()) - .stderr(Stdio::inherit()) - .spawn() - .map_err(|x| stack.error(ErrorKind::IO(x.to_string())))?; + stack.push( + Value::Long( + process::Command::new(&args[0]) + .args(&args[1..]) + .stdin(Stdio::inherit()) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .spawn() + .map_err(|x| stack.error(ErrorKind::IO(x.to_string())))? + .id() as i64, + ) + .spl(), + ); Ok(()) } @@ -1195,7 +1201,7 @@ pub fn register(r: &mut Stack, o: Arc) { ("alit-end", alit_end, 1), ("import", import, 0), ("readln", readln, 1), - ("command", command, 0), + ("command", command, 1), ("command-wait", command_wait, 1), ("str-to-bytes", str_to_bytes, 1), ("bytes-to-str", bytes_to_str, 1),