Skip to content

Conversation

@cspotcode
Copy link
Contributor

@cspotcode cspotcode commented Nov 18, 2025

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:

$ mise x -- node -e 'process.exit(123)' ; echo "$?"
123
# works the same when calling a shim executable from `mise activate --shims`
$ node -e 'process.exit(123)' ; echo "$?"
123

Bad Windows behavior today, before this PR:

$ mise x -- node -e 'process.exit(123)' ; echo "$?"
mise ERROR command failed: exit code 123
mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information
1

Note

On Windows, exec_program now exits with the child process's status code instead of converting non-zero exits into errors.

  • CLI runtime (Windows):
    • Update exec_program in src/cli/exec.rs to call std::process::exit(code) on Some(code) from the child, preserving/proxying the child's exit code.
    • Removes eyre error wrapping for non-zero exits; only signal-termination still returns an error.

Written by Cursor Bugbot for commit 8aecf5c. This will update automatically on new commits. Configure here.

…on Unix.

`mise x -- node -e "process.exit(123)" ; echo $?` should return exit code 123, not 1.
This worked as expected on Unix thanks to execvp, but not Windows where child's exit code
was converted to an eyre error which was logged and triggered exit code 1.
@cspotcode cspotcode changed the title On Windows, preserve/proxy the exit code of tools, to match behavior on Unix fix: On Windows, preserve/proxy the exit code of tools, to match behavior on Unix Nov 18, 2025
@jdx jdx enabled auto-merge (squash) November 18, 2025 07:01
@jdx jdx merged commit b5a87ed into jdx:main Nov 18, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants