Skip to content

wslc: add --workdir/-w support to container create and run#40190

Merged
ptrivedi merged 1 commit intofeature/wsl-for-appsfrom
user/ptrivedi/workdir-option
Apr 15, 2026
Merged

wslc: add --workdir/-w support to container create and run#40190
ptrivedi merged 1 commit intofeature/wsl-for-appsfrom
user/ptrivedi/workdir-option

Conversation

@ptrivedi
Copy link
Copy Markdown

Summary

  • Extends the --workdir/-w flag (already supported by container exec) to container create and container run
  • Passes the working directory through ContainerService::CreateInternal to the container launcher via SetWorkingDirectory()
  • Adds CLI parse test cases, unit tests (long option, short option, empty-value rejection), and E2E tests for both commands

Test plan

  • Unit tests: *WSLCCLIExecutionUnitTests* — covers RunCommand_ParseWorkDir* and CreateCommand_ParseWorkDir*
  • E2E tests: WSLCE2E_Container_Create_WorkDir, WSLCE2E_Container_Create_WorkDir_ShortAlias, WSLCE2E_Container_Run_WorkDir, WSLCE2E_Container_Run_WorkDir_ShortAlias
  • CLI parse tests: CommandLineParsingTests via CommandLineTestCases.h entries

🤖 Generated with Claude Code

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
@ptrivedi ptrivedi requested a review from a team as a code owner April 15, 2026 15:10
Copilot AI review requested due to automatic review settings April 15, 2026 15:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::WorkDir to container create and container run argument lists.
  • Pass WorkingDirectory into the container launcher via SetWorkingDirectory().
  • 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.

Comment thread test/windows/wslc/WSLCCLIExecutionUnitTests.cpp
Comment thread src/windows/wslc/services/ContainerService.cpp
Comment thread test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp
@ptrivedi ptrivedi merged commit be18a6b into feature/wsl-for-apps Apr 15, 2026
15 checks passed
@ptrivedi ptrivedi deleted the user/ptrivedi/workdir-option branch April 15, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants