Commit 2d8c8cf
[WSLC] Add --workdir / -w option to 'wslc exec' (#40041)
* [WSLC] Add --workdir / -w option to 'wslc exec'
Adds a --workdir (-w) argument to the exec command that sets the working
directory inside the container for the executed process. Wires the value
through ContainerOptions into WSLAProcessLauncher::SetWorkingDirectory.
Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6
* Update test/windows/wslc/CommandLineTestCases.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update test/windows/wslc/CommandLineTestCases.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix clang formatting issues
* Update test/windows/wslc/WSLCCLIExecutionUnitTests.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add E2E tests for wslc container exec, including --workdir option
- Port existing exec E2E tests from feature branch
- Add WSLCE2E_Container_Exec_WorkDir and WSLCE2E_Container_Exec_WorkDir_ShortAlias tests
- Update help message in GetAvailableOptions to include -w,--workdir
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix clang formatting in WSLCE2EContainerExecTests.cpp
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Validate --workdir is non-empty; add unit and parse test cases
- Reject empty or whitespace-only --workdir in Argument::Validate
- Add ExecCommand_ParseWorkDirEmptyValue_ThrowsArgumentException unit test
- Add empty-workdir failing case to CommandLineTestCases.h
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix clang formatting in CommandLineTestCases.h
Co-Authored-By: Claude Sonnet 4.6
* Trim exec E2E tests to --workdir coverage only
Remove tests that duplicate existing coverage in WSLCE2EContainerCreateTests.cpp.
Keep only the help message test (validates --workdir appears in output) and the
two workdir-specific E2E tests.
Co-Authored-By: Claude Sonnet 4.6
* Missed change from merge conflict resolution
* Fix --workdir whitespace validation to use std::iswspace for full Unicode coverage
Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/b21d1a57-bb3f-4a12-84cf-8e414a453890
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
* Use lambda with wint_t cast in iswspace call to avoid potential UB
Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/b21d1a57-bb3f-4a12-84cf-8e414a453890
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
* Missed change from merge conflict resolution
* Address Copilot PR feedback
- Revert Version ArgType alias from NO_ALIAS back to L"v" to preserve existing -v short option
- Restore WSLCE2EContainerExecTests.cpp lost in merge conflict resolution
Co-Authored-By: Pooja Trivedi
* Update src/windows/wslc/services/ContainerService.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix ParserTest_StateMachine_PositionalForward: replace -v with -h in flag parse tests
The -v short alias was removed from --verbose (changed to NO_ALIAS) to
resolve a triple alias conflict with --version and --volume. The parser
test cases in the Run argument set still used -v expecting it to resolve
to --verbose, but since neither Version nor Volume are in the Run set,
-v became unresolvable and caused unexpected parse failures.
Replace -v with -h (help flag) in the flag parse test cases to preserve
the same combined-flag parsing coverage with a valid short alias.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix E2E exec help test: add --user option after base branch merge
After merging feature/wsl-for-apps, the --user argument is now active
in ContainerExecCommand (from PR #40101). Update the expected exec help
output to include -u,--user.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent a8ee043 commit 2d8c8cf
12 files changed
Lines changed: 247 additions & 18 deletions
File tree
- localization/strings/en-US
- src/windows/wslc
- arguments
- commands
- services
- tasks
- test/windows/wslc
- e2e
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2394 | 2394 | | |
2395 | 2395 | | |
2396 | 2396 | | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
2397 | 2400 | | |
2398 | 2401 | | |
2399 | 2402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
50 | 61 | | |
51 | 62 | | |
52 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
411 | 415 | | |
412 | 416 | | |
413 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
296 | 301 | | |
297 | 302 | | |
298 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
101 | | - | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
113 | | - | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
119 | 191 | | |
120 | 192 | | |
121 | 193 | | |
| |||
0 commit comments