Plumb WASI exit codes through to the CLI
itsrainy opened this issue · 0 comments
itsrainy commented
In run-mode, rather than just exiting with ExitCode::SUCCESS
or ExitCode::FAILURE
, capture the return code from WASI and emit that as the exit code. For example, running the following wasm program in run mode should result in viceroy exiting with error code 4:
(module
(import "wasi_snapshot_preview1" "proc_exit"
(func $proc_exit (param i32)))
(export "_start" (func $_start))
(memory 10)
(export "memory" (memory 0))
(func $_start
(call $proc_exit (i32.const 4))
)
)
Here is an example of the wasmtime cli doing a similar thing