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 API missing function to enumerate installed distributions #4644

Open
riverar opened this issue Nov 4, 2019 · 9 comments
Open

WSL API missing function to enumerate installed distributions #4644

riverar opened this issue Nov 4, 2019 · 9 comments
Labels

Comments

@riverar
Copy link

@riverar riverar commented Nov 4, 2019

Consuming the WSL API requires developers to populate the distribution name parameter for most functions. There is no API to retrieve a list of valid distribution names, however, and none of the APIs support a nullptr input to signify the user's default distribution should be used, as general Win32 programming patterns would nudge you towards.

How are developers meant to consume these APIs? The dev story seems incomplete.

Related: #3515 #3543

@Biswa96
Copy link

@Biswa96 Biswa96 commented Nov 4, 2019

The Microsoft-ish suggestion is to parse the output of wsl.exe -l -v command. You can use the other way, you-know-what.

@riverar
Copy link
Author

@riverar riverar commented Nov 4, 2019

Ha, parsing executable output is not a solution.

@therealkenc
Copy link
Collaborator

@therealkenc therealkenc commented Nov 6, 2019

Trick to turn this tag feature, contrast death by tag discussion ref #3515, is providing the use case for your AP change request. [With no implication there is no use case. But that's how the dupe died two weeks after it was opened.]

@riverar
Copy link
Author

@riverar riverar commented Nov 9, 2019

@therealkenc no idea what your comment means, looks like a typo?

@therealkenc
Copy link
Collaborator

@therealkenc therealkenc commented Nov 9, 2019

This submission is spiritually similar to #3515. #3515 was a discussion thread (label/tag 'discussion') that ran course and was closed. The hope is some use cases for the implied API enhancement are provided, thumbs up on the OP appear, and this one (which to be clear is entirely sensible) has a better chance than #3515. Question / observational commentary ("How are developers meant to consume these APIs? The dev story seems incomplete"), on a statistical basis anyway, usually end up chirping crickets.

@riverar
Copy link
Author

@riverar riverar commented Nov 9, 2019

Thanks for clarifying. (I fundamentally have an issue with your ability to label/close issues using an imaginary rubric and without Microsoft involvement.)

In this particular case, Microsoft is providing an API that is useless without the enumeration capability and I'd continue to argue this is a bug.

@javierdlg
Copy link
Member

@javierdlg javierdlg commented Jun 12, 2020

+1 to enumerate wls list via the API. I'm building a remoting terminal that also supports WSL but I can't list them to the user without having to parts executable output. Would love if I could query for it instead of parsing text.

@TBBle
Copy link

@TBBle TBBle commented Jun 21, 2020

I think this API would also improve the Windows Terminal support for autogenerating profiles for WSL distros, which currently contains 70 lines of boilerplate code to call and parse wsl --list (plus six more), before 12 lines of actual code.

I assume the Windows Terminal team would rather consume an API from wslapi.h than maintain this code, but haven't checked.

@Biswa96
Copy link

@Biswa96 Biswa96 commented Apr 29, 2021

From Build 21327, it has been easier to enumerate WSL-ed distributions with undocumented IWslSupport COM interface. Something is coming... 🔍

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

5 participants