diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs index 019eb6f9123..ee6232943cc 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/deno.rs @@ -1,13 +1,10 @@ -use std::fs; use std::path::Path; use std::process::Command; +use std::{fs, process}; use anyhow::{Context, Error}; -use crate::{ - node::{exec, SHARED_SETUP}, - Cli, -}; +use crate::{node::SHARED_SETUP, Cli}; pub fn execute(module: &str, tmpdir: &Path, cli: Cli, tests: &[String]) -> Result<(), Error> { let mut js_to_execute = format!( @@ -60,10 +57,15 @@ if (!ok) Deno.exit(1);"#, .arg(&js_path) .args(args), )*/ - exec( - Command::new("deno") - .arg("run") - .arg("--allow-read") - .arg(&js_path), - ) + let status = Command::new("deno") + .arg("run") + .arg("--allow-read") + .arg(&js_path) + .status()?; + + if !status.success() { + process::exit(status.code().unwrap_or(1)) + } else { + Ok(()) + } } diff --git a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs index 68249ad7da9..303583e7f2c 100644 --- a/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs +++ b/crates/cli/src/bin/wasm-bindgen-test-runner/node.rs @@ -1,6 +1,7 @@ use std::env; use std::fs; use std::path::{Path, PathBuf}; +use std::process; use std::process::Command; use anyhow::{Context, Error}; @@ -138,27 +139,17 @@ pub fn execute( .map(|s| s.to_string()) .filter(|s| !s.is_empty()) .collect::>(); - exec( - Command::new("node") - .env("NODE_PATH", env::join_paths(&path).unwrap()) - .arg("--expose-gc") - .args(&extra_node_args) - .arg(&js_path), - ) -} -#[cfg(unix)] -pub fn exec(cmd: &mut Command) -> Result<(), Error> { - use std::os::unix::prelude::*; - Err(Error::from(cmd.exec()).context(format!( - "failed to execute `{}`", - cmd.get_program().to_string_lossy() - ))) -} + let status = Command::new("node") + .env("NODE_PATH", env::join_paths(&path).unwrap()) + .arg("--expose-gc") + .args(&extra_node_args) + .arg(&js_path) + .status()?; -#[cfg(windows)] -pub fn exec(cmd: &mut Command) -> Result<(), Error> { - use std::process; - let status = cmd.status()?; - process::exit(status.code().unwrap_or(3)); + if !status.success() { + process::exit(status.code().unwrap_or(1)) + } else { + Ok(()) + } }