-
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 does not exit with the same code as the wasm main on Windows #6352
Comments
On Windows, error codes have a different meaning than on Unix. Error code 100 on Windows means "Cannot create another system semaphore", which wouldn't correctly reflect the intent of a portable program, so Wasmtime normalizes error codes. |
I see, this it the how the dotnet runtime tests work so would have thought they would be ok. Note that node.js behaves in line with how these tests are run. However if it is not consider wrong, then I can take it up with the dotnet team and perhaps change the how the test results are analysed. |
There is some design tension here. On one hand there's a desire to have WASI programs be portable and avoid having assumptions about how they're being used. On the other hand, this dotnet example shows an example of programs that know how they're going to be used and have a special convention that only has meaning in that context. We could potentially relax this, within some limits (Unix has more restrictions on the value). Perhaps one question is, how much of a need is there for real-world programs to use custom error code conventions, rather than just specialized situations like test harnesses? |
Rust uses 101 for panics. |
These are the code for |
Some more investigation, |
There are programs which return the Wasmtime is starting to anticipate WASI Preview2 in some parts of its implementation, and Preview2 currently has only a boolean success-or-failure exit status from commands. I've now filed WebAssembly/wasi-cli#11 to discuss expanding it. |
Thanks, @sunfishcode do you want to close this then and it can just be taken up in WebAssembly/wasi-cli#11 ? That would be fine with me. |
Yeah, seems like we should have one issue for this: I also had WebAssembly/WASI#524 open which I believe is similar. |
Test Case
Create a wasm which as a main that exits with a return value > 1. E.g. the attached
Steps to Reproduce
Expected Results
should print 100
Actual Results
prints 1
Versions and Environment
Wasmtime version or commit: wasmtime-cli 9.0.0
Operating system: Win11
Architecture: x64
Extra Info
Node.js prints 100 for this test. Thanks!
HelloWasm.zip
The text was updated successfully, but these errors were encountered: