wslapi WslGetDistributionState proposal
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
**Is your feature request related to a problem? Please describe.**
There seems to be no programmatic way to get the current state of a specific distro, currently there are no API functions that could get this information, nor it is stored/updated on the registry.
The only way I have found to actually know if a Distro is running or stopped is to get use wsl.exe --list --verbose or wsl.exe --list --running and parse the output.
**Describe the solution you'd like**
It would be nice if there is a function where you can pass the distro identifier and it returns its current state.
```
HRESULT WslGetDistributionState(
[in] PCWSTR distributionName,
[out] WSL_DISTRIBUTION_STATE wslDistributionState
);
typedef enum {
WSL_DISTRIBUTION_STATE_STOPPED = 0x0,
WSL_DISTRIBUTION_STATE_RUNNING = 0x1,
WSL_DISTRIBUTION_STATE_STARTING = 0x2,
WSL_DISTRIBUTION_STATE_STOPPING = 0x3,
} WSL_DISTRIBUTION_STATE;
```
**Describe alternatives you've considered**
n/a.
**Additional context**
I haven't found any other possible programmatic way to know what possible states there are or even any documentation on how the wsl.exe itself define a Distro state. As there is no 1:1 tie to any running processes or PID that could be binded to.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files or tests. Start by tracing how wsl.exe --list --verbose and --list --running determine a distribution's state, then review the existing WSL API patterns. Done means a supported API accepts a distribution identifier and reports its current state consistently.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100