diff --git a/lib/c-api/src/wasm_c_api/externals/function.rs b/lib/c-api/src/wasm_c_api/externals/function.rs index e72c277ed..5ac8c7a08 100644 --- a/lib/c-api/src/wasm_c_api/externals/function.rs +++ b/lib/c-api/src/wasm_c_api/externals/function.rs @@ -223,7 +223,10 @@ pub unsafe extern "C" fn wasm_func_call( None } - Err(e) => Some(Box::new(e.into())), + Err(e) => { + println!("error: {e}"); + Some(Box::new(e.into())) + } } } diff --git a/lib/cli/src/commands/wasmer_create_exe_main.c b/lib/cli/src/commands/wasmer_create_exe_main.c index 9ec238259..3efa2f059 100644 --- a/lib/cli/src/commands/wasmer_create_exe_main.c +++ b/lib/cli/src/commands/wasmer_create_exe_main.c @@ -234,8 +234,15 @@ int main(int argc, char *argv[]) { wasm_val_vec_t results = WASM_EMPTY_VEC; own wasm_trap_t *trap = wasm_func_call(start_function, &args, &results); if (trap) { - fprintf(stderr, "Trap is not NULL: TODO:\n"); - return -1; + wasm_message_t retrieved_message; + // TODO: this is a shitty solution, but it's good enough for now + wasm_trap_message(trap, &retrieved_message); + if (strcmp(retrieved_message.data, "WASI exited with code: 0") == 0) { + wasm_trap_delete(trap); + } else { + fprintf(stderr, "%s", retrieved_message.data); + return -1; + } } #endif diff --git a/tests/integration/cli/tests/create_exe.rs b/tests/integration/cli/tests/create_exe.rs index f90f601f4..38dcfa2a0 100644 --- a/tests/integration/cli/tests/create_exe.rs +++ b/tests/integration/cli/tests/create_exe.rs @@ -195,7 +195,7 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> { .run() .context("Failed to create-exe wasm with Wasmer")?; - let _result = run_code( + let result = run_code( &operating_dir, &executable_path, &[ @@ -206,6 +206,9 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> { ) .context("Failed to run generated executable")?; + let result_lines = result.lines().collect::>(); + assert_eq!(result_lines, vec!["1.0.37 (git~v1.0.37)"]); + let result = run_code( &operating_dir, &executable_path, @@ -218,7 +221,7 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> { .context("Failed to run generated executable")?; let result_lines = result.lines().collect::>(); - assert_eq!(result_lines, vec!["\"Hello, World\""],); + assert_eq!(result_lines, vec!["1.0.37 (git~v1.0.37)"]); Ok(()) } @@ -395,8 +398,6 @@ fn create_exe_with_object_input(mut args: Vec) -> anyhow::Result<()> { args.push("--prefix".to_string()); args.push("abc123".to_string()); - args.push("--debug-dir".to_string()); - args.push("tmp".to_string()); WasmerCreateObj { current_dir: operating_dir.clone(), diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 4a9ceb4d0..9edc91922 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -63,8 +63,6 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { output.arg(wasi_test_python_path()); output.arg("--target"); output.arg(t); - output.arg("--debug-dir"); - output.arg(&format!("./{t}-{c}")); output.arg("-o"); output.arg(python_wasmer_path.clone()); output.arg(format!("--{c}"));