fix: On Windows, preserve/proxy the exit code of tools, to match behavior on Unix #7001
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.
mise x -- node -e "process.exit(123)"should return exit code 123, not 1, and it should not log anything to either stdout nor stderr.This works as expected on Unix thanks to
execvp, but not Windows where the child's exit code is converted to an eyre error which is logged and triggers exit code 1.This PR fixes Windows to behave like Unix.
Discord context: https://discord.com/channels/1066429325269794907/1314301006992900117/1440123300230729882
Discussion: #6995
Example of the desirable behavior on Linux today. This is also the behavior on Windows after this PR:
Bad Windows behavior today, before this PR:
Note
On Windows,
exec_programnow exits with the child process's status code instead of converting non-zero exits into errors.exec_programinsrc/cli/exec.rsto callstd::process::exit(code)onSome(code)from the child, preserving/proxying the child's exit code.Written by Cursor Bugbot for commit 8aecf5c. This will update automatically on new commits. Configure here.