Skip to content

WSL API missing function to enumerate installed distributions #4644

Closed as not planned

Description

@riverar

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

Activity

  1. Biswa96 commented on Nov 4, 2019

    @Biswa96

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

  2. riverar commented on Nov 4, 2019

    @riverar
    Author

    Ha, parsing executable output is not a solution.

  3. therealkenc commented on Nov 6, 2019

    @therealkenc

    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.]

  4. riverar commented on Nov 9, 2019

    @riverar
    Author

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

  5. therealkenc commented on Nov 9, 2019

    @therealkenc

    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.

  6. riverar commented on Nov 9, 2019

    @riverar
    Author

    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.

  7. javierdlg commented on Jun 12, 2020

    @javierdlg
    Member

    +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.

  8. TBBle commented on Jun 21, 2020

    @TBBle

    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.

  9. Biswa96 commented on Apr 29, 2021

    @Biswa96

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions