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

Publish into the running instance the WSL version #91

Closed
lucasvc opened this issue Feb 22, 2021 · 5 comments
Closed

Publish into the running instance the WSL version #91

lucasvc opened this issue Feb 22, 2021 · 5 comments

Comments

@lucasvc
Copy link

lucasvc commented Feb 22, 2021

From the PowerShell/cmd line you can check which WSL version is each of the installed distros you have:

wsl -l -v

Unfortunatelly, windows is not publishing into the running instance which is the WSL version running, neither they indicate how to obtain that information from the running shell (question on superuser with some unofficial options).

Could it be possible to add this version value from the Launcher retrieved previous start?

@yuk7
Copy link
Owner

yuk7 commented Feb 22, 2021

You can get WSL version (1 or 2) of instance:
Launcher.exe get --wsl-version

@yuk7 yuk7 added the question label Feb 22, 2021
@lucasvc
Copy link
Author

lucasvc commented Feb 22, 2021

I meant to retrieve the version from the running Linux.

As I pointed in the question (made by myself) there is a not clear environment variable and the Kernel uname options, but none are official nor reliable.

So I don't know if Launcher can add environment variables before starting the WSL command line, adding that --wsl-version in a new environment variable named WSL_VERSION or similar.

If my C knowledge would not be so rusty I could set a PR, sorry :(

@yuk7 yuk7 added enhancement and removed question labels Feb 22, 2021
@yuk7
Copy link
Owner

yuk7 commented Feb 22, 2021

ah, sorry, I understood.
You are right.
Guessing the WSL version from uname is not accurate.

Now, we don't provide wsl version information to environment variable.

@yuk7
Copy link
Owner

yuk7 commented Feb 22, 2021

I think it is difficult to provide that function.
Users don't always launch using our launcher.

@lucasvc
Copy link
Author

lucasvc commented Feb 22, 2021

Users don't always launch using our launcher.

Yes, ideally should be that Microsoft provides it (I probably will open an issue later).
Or you mean that not everyone that has the Launcher use it as "executable" and they use the wsl command?

UPDATE: SuperUser question has a good workaround, so feel free to close this.

@yuk7 yuk7 closed this as completed Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants