Stream: wasi

Topic: CLI exit codes


view this post on Zulip Joel Dice (Jun 20 2024 at 21:28):

We're having a discussion over in .NET land about CLI exit codes. Currently, many of the .NET test cases return an exit code of 100 for success and -1 for error, which worked fine with WASIp1, but since WASIp2 only has an exit function that takes a result (i.e. either ok or err), we can't do that anymore.

I assume the rationale for not supporting exit codes is that they're not sufficiently portable. Is there more to it than that? Would we ever consider adding an exit-with-code to a future WASI release?

Discord is great for playing games and chilling with friends, or even building a worldwide community. Customize your own space to talk, play, and hang out.

view this post on Zulip Alex Crichton (Jun 20 2024 at 21:30):

AFAIK it was just portability where unix only gives you an 8-bit range or something like that and a number of windows return codes are "special" so being able to fake them in WASI felt odd

view this post on Zulip Alex Crichton (Jun 20 2024 at 21:30):

I think there's a subset of codes though which are the same across OSes which could be supported, probably not a full 32-bit space though

view this post on Zulip Joel Dice (Jun 20 2024 at 21:31):

Ah, we just found this: https://github.com/WebAssembly/wasi-cli/issues/11

Currently the exit status of a command is a result<_, _>, meaning it's a boolean success or failure. That has the advantage that we don't need to think about the meanings of exit statuses across pl...

Last updated: Oct 23 2024 at 20:03 UTC