Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsl.exe always returns 0 exit code #138

Closed
nzbr opened this issue Oct 4, 2022 · 1 comment · Fixed by #140
Closed

wsl.exe always returns 0 exit code #138

nzbr opened this issue Oct 4, 2022 · 1 comment · Fixed by #140
Labels
bug Something isn't working

Comments

@nzbr
Copy link
Member

nzbr commented Oct 4, 2022

Bug description

Regardless of the exit code of the command that runs inside WSL, the wsl.exe binary always returns an exit code of 0

To Reproduce

Steps to reproduce the behavior:
Run

wsl.exe -d NixOS false
echo $LASTEXITCODE

Expected behavior

$LASTEXITCODE should be 1

Logs

PS C:\Users\nzbr> wsl -d NixOS false

PS C:\Users\nzbr> echo $LASTEXITCODE
0
PS C:\Users\nzbr> wsl -d Ubuntu false
PS C:\Users\nzbr> echo $LASTEXITCODE
1
PS C:\Users\nzbr>

I verified that it works with Ubuntu, so this is most likely a problem with syschdemd. I haven't tested with the new native systemd feature yet, but I expect that to work

@nzbr nzbr added the bug Something isn't working label Oct 4, 2022
@nzbr
Copy link
Member Author

nzbr commented Oct 8, 2022

Apparently, we need to switch to systemd-run instead of machinectl in order to get this to work
systemd/systemd#4215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant