Set exit codes for scala-js + scala-native #7906
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When targeting Scala.js and/or Scala Native, it would be nice to have the exit code of the process set correctly, as it is with the JVM.
I believe Scala native already supports using System.exit, java.lang.System is listed here: https://scala-native.org/en/stable/lib/javalib.html , and here is a corresponding test where it is used https://github.com/scala-native/scala-native/blob/main/scripted-tests/run/system-exit/src/main/scala/Exit.scala
For nodejs, and this api https://nodejs.org/api/process.html#processexitcode_1, we can gracefully set an exit code. From the docs:
I've built + run these changes locally to confirm, but I'd be happy to set up a corresponding test suite with some guidance of similar tests that might already be in place.