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

Better exit codes for WSL cmd #10414

Closed
KarelChanivecky opened this issue Aug 22, 2023 · 2 comments
Closed

Better exit codes for WSL cmd #10414

KarelChanivecky opened this issue Aug 22, 2023 · 2 comments
Labels

Comments

@KarelChanivecky
Copy link

KarelChanivecky commented Aug 22, 2023

Is your feature request related to a problem? Please describe.
It is difficult to use WSL in another program because a lot of different issues seem to cause WSL to exit with the same code.
Also, it is difficult to understand all the different reasons that can cause the WSL cmd to fail.

Some examples of some of the errors I have ran into:

  • WSL is not enabled at all
  • WSL kernel is not installed/out of date
  • VM/Container took too long to respond
  • Distro is not installed
  • File not found error when importing distro
  • Distro name is already taken
  • install path of distro is not available

Describe the solution you'd like
A unique, explicit exit code for each problem that occurs. The exit codes are listed in the WSL documentation.

Describe alternatives you've considered
I currently use a combination of return code and matching resulting text from stdout/stderr to determine the WSL state.
The matching text within stdout/stderr is very unreliable, as the text can change on a developer's whim, but there is no other way that I know of.

@OneBlue
Copy link
Collaborator

OneBlue commented Aug 23, 2023

Thank you for the suggestion @KarelChanivecky. Unfortunately this would be an API change since other programs depend on existing return codes so this is not a change we can make without causing major issues for existing users.

@OneBlue OneBlue closed this as completed Aug 23, 2023
@KarelChanivecky
Copy link
Author

Of course that would be a breaking change. However, there is always the possibility of providing a separate executable meant for programmatic use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants