[WSLC] Add wslc get cli session api#40141
[WSLC] Add wslc get cli session api#40141chemwolf6922 wants to merge 1 commit intofeature/wsl-for-appsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new WSLC SDK entrypoint to obtain the default “CLI session” and centralizes the default CLI session naming logic so it can be shared by both the SDK and the wslc CLI.
Changes:
- Added
WslcGetCliSessionto the WSLC SDK (header + export + implementation) to open the default CLI session by name. - Introduced
wsl::windows::common::WSLCSessionDefaults(shared defaults forwslc-cli/wslc-cli-admin) and updated CLI/task/model/test code to use it. - Added a Windows test validating
WslcGetCliSessionbehavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WslcSdkTests.cpp | Adds GetCliSession SDK test and a release-only RAII wrapper for session refs. |
| test/windows/wslc/e2e/WSLCE2EHelpers.cpp | Switches default session name lookup to the new common defaults helper. |
| src/windows/WslcSDK/wslcsdk.h | Declares the new public WslcGetCliSession API. |
| src/windows/WslcSDK/wslcsdk.def | Exports WslcGetCliSession from the SDK DLL. |
| src/windows/WslcSDK/wslcsdk.cpp | Implements WslcGetCliSession by opening the default session by name. |
| src/windows/wslc/tasks/SessionTasks.cpp | Uses the common defaults helper for default session name + default-name checks. |
| src/windows/wslc/services/SessionModel.h | Removes default session naming helpers/constants from SessionOptions. |
| src/windows/wslc/services/SessionModel.cpp | Uses common defaults for display name and storage path selection. |
| src/windows/common/WslSecurity.h | Adds security::IsElevated() declaration. |
| src/windows/common/WslSecurity.cpp | Implements security::IsElevated() using the current access token. |
| src/windows/common/WSLCSessionDefaults.h | New common header encapsulating elevation-aware default session naming. |
| src/windows/common/CMakeLists.txt | Registers the new common header in the common target headers list. |
|
Just curious about the context of the change, what're the scenarios that an app will need to access a cli session? |
Hi @yao-msft , Please refer to the build experience design doc. I'll try to send you internally. In short, this is for the dev loop where the developer builds their image in the cli session and pick it up directly when debugging. |
e7ada17 to
3300195
Compare
Summary of the Pull Request
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Add test: WslcSdkTests::GetCliSession