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

Include an option in wsl command to force the output to English #7654

Open
crramirez opened this issue Nov 7, 2021 · 5 comments
Open

Include an option in wsl command to force the output to English #7654

crramirez opened this issue Nov 7, 2021 · 5 comments
Labels

Comments

@crramirez
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When writing programs or script that calls the wsl command and parses the output, it is challenging if it changes depending on the language installed on the PC. For example, now in the WSL Store version if I call wsl --export, depending on the output I must guess the result. Before this change, no output meant success. Now I must parse the output.

Describe the solution you'd like
I want an option to be added like --force-english-output or --force-locale-output XX to the wsl command to output in a language different from the installed one.

@benhillis
Copy link
Member

@crramirez - I would suggest just keying off the process exit code, which should be 0 on success and nonzero on failure.

@crramirez
Copy link
Contributor Author

OK I didn't know this work for this command. I'll test. This will solve me this punctual problem.

Nevertheless, I would like this should implemented parsing for example wsl --list --verbose is complicated with localization. Also scanning the wsl --help results to guess which wsl capabilities are available.

Thanks for the suggestion

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 10, 2021

I think making wsl --list --verbose 's output easier to parse is a good suggestion. Maybe adding a flag to suppress all localized strings in that command would be the simplest

If you need to dynamically scan for WSL features, the simplest would be to use WSL from the Microsoft store and have a minimum version number

@crramirez
Copy link
Contributor Author

@benhillis checking the exit codes works very well.

@OneBlue the WSL from the Store is not an option for me. It is only available in Windows 11. Windows 10 1909 is still supported and it has a WSL version different from Windows 10 2004 and Windows 11 and also the store version. This is why I scan the wsl --help.

@Biswa96
Copy link

Biswa96 commented Nov 14, 2021

When writing programs or script that calls the wsl command and parses the output

There is another way which doesn't require parsing the output while exporting distro, you-know-how 🤐

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

4 participants