-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasmtime C API: Missing way to retrieve the WASI exit code when using wasmtime_func_call_unchecked
#5257
Comments
Oh dear you are right, thanks for the report! I'll work on updating this API today to return the error/trap combo. I think the error/trap combo probably needs to be redone in the future since it makes less sense than it did before, but in the meantime no functionality should be lost with this prior refactoring. |
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this issue
Nov 14, 2022
Change the return value of this function to a `wasmtime_error_t*` instead of the prior `wasm_trap_t*`. This is a leftover from bytecodealliance#5149. Closes bytecodealliance#5257
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this issue
Nov 14, 2022
…ytecodealliance#5262) Change the return value of this function to a `wasmtime_error_t*` instead of the prior `wasm_trap_t*`. This is a leftover from bytecodealliance#5149. Closes bytecodealliance#5257
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
As far as I understand the trap redesign with #5149 regarding the C API, host traps/errors created with
wasmtime_trap_new
, as well as traps caused by setting the WASI exit code (by calling WASI'sproc_exit
), are now returned aswasmtime_error_t*
instead ofwasm_trap_t*
(e.g. withwasmtime_func_call
andwasmtime_linker_instantiate
); whereas normally only actual WASM traps that have a corresponding trap code (wasmtime_trap_code_t
) are still returned aswasm_trap_t*
.With #5215, the WASI exit code can now be retrieved from the
wasmtime_error_t*
.However, the unchecked variant
wasmtime_func_call_unchecked
only returns awasm_trap_t*
, but nowasmtime_error_t*
. Therefore, it doesn't seem possible e.g. to extract the WASI exit code from it:wasmtime/crates/c-api/include/wasmtime/func.h
Lines 244 to 248 in 95ca72a
Would this require an adjustment of the C API? E.g., should
wasmtime_func_call_unchecked
additionally return awasmtime_error_t*
, for consistency withwasmtime_func_call
, so that it would return host traps and WASI exit traps aswasmtime_error_t*
, instead ofwasm_trap_t*
?Thanks!
The text was updated successfully, but these errors were encountered: