tomjmech opened issue #6088:
Test Case
;; example.wat (module (import "wasi_snapshot_preview1" "proc_exit" (func $proc_exit (param $exitcode i32)) ) (memory $memory (export "memory") 1) (func $_start (export "_start") (i32.const 3) ;; Exit Code (call $proc_exit) ) )
Steps to Reproduce
In PowerShell
wasmtime example.wat $LASTEXITCODE
Expected Results
Shows exit code 3
Actual Results
Shows exit code 1
Versions and Environment
wasmtime-cli 6.0.1
Operating system: Windows
Architecture: 64-bit
Extra Info
On Windows, exit codes >= 3 are returned as 1
Exit codes 0, 1 and 2 are returned as expected
Is this a bug in Wasmtime?
tomjmech labeled issue #6088:
Test Case
;; example.wat (module (import "wasi_snapshot_preview1" "proc_exit" (func $proc_exit (param $exitcode i32)) ) (memory $memory (export "memory") 1) (func $_start (export "_start") (i32.const 3) ;; Exit Code (call $proc_exit) ) )
Steps to Reproduce
In PowerShell
wasmtime example.wat $LASTEXITCODE
Expected Results
Shows exit code 3
Actual Results
Shows exit code 1
Versions and Environment
wasmtime-cli 6.0.1
Operating system: Windows
Architecture: 64-bit
Extra Info
On Windows, exit codes >= 3 are returned as 1
Exit codes 0, 1 and 2 are returned as expected
Is this a bug in Wasmtime?
pchickey commented on issue #6088:
This is the intended behavior on windows - wasmtime is distinguishing between a program that chose to exit (by calling proc_exit) vs a program that aborted via a wasm trap: https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasi/src/lib.rs#L102-L107
In the WASI Preview 2 draft, we decided to do away with the exit code passed to proc_exit, because we can't implement this sort of consistent behavior across platforms.
pchickey closed issue #6088:
Test Case
;; example.wat (module (import "wasi_snapshot_preview1" "proc_exit" (func $proc_exit (param $exitcode i32)) ) (memory $memory (export "memory") 1) (func $_start (export "_start") (i32.const 3) ;; Exit Code (call $proc_exit) ) )
Steps to Reproduce
In PowerShell
wasmtime example.wat $LASTEXITCODE
Expected Results
Shows exit code 3
Actual Results
Shows exit code 1
Versions and Environment
wasmtime-cli 6.0.1
Operating system: Windows
Architecture: 64-bit
Extra Info
On Windows, exit codes >= 3 are returned as 1
Exit codes 0, 1 and 2 are returned as expected
Is this a bug in Wasmtime?
Last updated: Dec 23 2024 at 13:07 UTC