wslc: add --workdir/-w support to container create and run#40190
Merged
ptrivedi merged 1 commit intofeature/wsl-for-appsfrom Apr 15, 2026
Merged
wslc: add --workdir/-w support to container create and run#40190ptrivedi merged 1 commit intofeature/wsl-for-appsfrom
ptrivedi merged 1 commit intofeature/wsl-for-appsfrom
Conversation
Extends the --workdir flag (already supported by container exec) to the container create and run commands, passing the working directory through to the container launcher. Adds CLI parse tests, unit tests, and E2E tests for both commands. Co-Authored-By: Claude Sonnet
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds --workdir/-w support for container create and container run, ensuring the working directory is propagated into the container launcher and covered by CLI/unit/E2E tests.
Changes:
- Add
ArgType::WorkDirtocontainer createandcontainer runargument lists. - Pass
WorkingDirectoryinto the container launcher viaSetWorkingDirectory(). - Add CLI parse test cases, unit tests, and E2E tests for both long/short forms and empty-value rejection.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp | Adds E2E coverage and help-text expectations for --workdir/-w on container run. |
| test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp | Adds E2E coverage and help-text expectations for --workdir/-w on container create. |
| test/windows/wslc/WSLCCLIExecutionUnitTests.cpp | Adds unit tests validating parsing/validation and option propagation for workdir on run/create. |
| test/windows/wslc/CommandLineTestCases.h | Adds command-line parsing matrix entries for --workdir/-w and related failure cases. |
| src/windows/wslc/services/ContainerService.cpp | Propagates the parsed working directory into the container launcher. |
| src/windows/wslc/commands/ContainerRunCommand.cpp | Exposes --workdir/-w in the run command argument list. |
| src/windows/wslc/commands/ContainerCreateCommand.cpp | Exposes --workdir/-w in the create command argument list. |
AmelBawa-msft
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--workdir/-wflag (already supported bycontainer exec) tocontainer createandcontainer runContainerService::CreateInternalto the container launcher viaSetWorkingDirectory()Test plan
*WSLCCLIExecutionUnitTests*— coversRunCommand_ParseWorkDir*andCreateCommand_ParseWorkDir*WSLCE2E_Container_Create_WorkDir,WSLCE2E_Container_Create_WorkDir_ShortAlias,WSLCE2E_Container_Run_WorkDir,WSLCE2E_Container_Run_WorkDir_ShortAliasCommandLineParsingTestsviaCommandLineTestCases.hentries🤖 Generated with Claude Code