Stream: ideas

Topic: Changing exit codes for roc build and check


view this post on Zulip Isaac Van Doren (Jan 14 2024 at 03:39):

Right now roc check and roc build both return non-zero exit codes when there are warnings. This poses a problem for roc-wasm4 because when using zig to build an app, zig thinks the build has failed any time there are warnings due to the error exit code.

I propose that roc check and roc build be changed to return 0 when there are errors but no warnings. It seems more natural to me for build to return a success when it has built a definitely runnable binary, and zero otherwise. If that is the case, it seems best for check and build to follow the same convention for exit codes. This would fix the issue for roc-wasm4 and other similar situations.

If there is desire for it, we could add a flag that would cause the commands to return non-zero when there are warnings.

view this post on Zulip Richard Feldman (Jan 14 2024 at 03:42):

so the original reason for this design was specifically to make CI builds fail on warnings by default

view this post on Zulip Richard Feldman (Jan 14 2024 at 03:43):

because without that behavior, warnings tend to get ignored and therefore accumulate by default :sweat_smile:

view this post on Zulip Isaac Van Doren (Jan 14 2024 at 05:03):

Mm that does make sense. How about a flag to ignore the warnings then?

view this post on Zulip Richard Feldman (Jan 14 2024 at 05:04):

yeah I could see that

view this post on Zulip Isaac Van Doren (Jan 14 2024 at 05:14):

The most obvious thing to me is --ignoreWarnings, but perhaps it would be useful for the flag to only change the exit code and still display the warnings. Even if it would be useful to only change the exit code, it does seem less obvious and I'm not sure what a good name for it would be. What do you think?

view this post on Zulip Brendan Hansknecht (Jan 14 2024 at 05:15):

I like --ignoreWarnings and just changing the exit code but still displaying the warnings

view this post on Zulip Isaac Van Doren (Jan 14 2024 at 05:41):

That sounds good to me

view this post on Zulip Isaac Van Doren (Jan 14 2024 at 05:43):

I created #6381

view this post on Zulip Kevin Gillette (Jan 18 2024 at 06:01):

--ignore-warnings would be the more conventional [unix style] spelling. snake_case and camelCase are not as elegant as kebab-case on the command-line

view this post on Zulip Isaac Van Doren (Jan 18 2024 at 14:17):

Yep, that’s the spelling I used in the first iteration of the PR, but we decided to forgo the flag all together and see if returning a different exit code when there are only warnings is enough to solve the issue


Last updated: Jun 16 2026 at 16:19 UTC