Commit 2210d7a
authored
fix(powershell): use Invoke-Expression to pass args (#8278)
Continuation of #8267 @mbtools
---
This fixes the command `npm test -- hello -p1 world -p2 "hello world"
--q1=hello world --q2="hello world"` in Windows PowerShell and pwsh7
- where the "test" script prints all the arguments passed after the
first "--" in the command above
Before this change
```
PS> npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world"
npm warn "world" is being parsed as a normal command line argument.
npm warn "hello world" is being parsed as a normal command line argument.
npm warn Unknown cli config "--p1". This will stop working in the next major version of npm.
npm warn Unknown cli config "--p2". This will stop working in the next major version of npm.
npm warn Unknown cli config "--q1". This will stop working in the next major version of npm.
npm warn Unknown cli config "--q2". This will stop working in the next major version of npm.
> [email protected] test
> node args.js hello world hello world world
hello
world
hello world
world
```
With this change
```
PS> npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world"
> [email protected] test
> node args.js hello -p1 world -p2 hello world --q1=hello world --q2=hello world
hello
-p1
world
-p2
hello world
--q1=hello
world
--q2=hello world
```
---
Also, fixes comma-separated values in Windows PowerShell and pwsh7
Before this change
```
PS> npm help a=1,b=2,c=3
No matches in help for: a=1 b=2 c=3
```
With this change
```
PS> npm help a=1,b=2,c=3
No matches in help for: a=1,b=2,c=3
```1 parent 4dd41c9 commit 2210d7a
3 files changed
+105
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
| |||
112 | 127 | | |
113 | 128 | | |
114 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
115 | 136 | | |
116 | 137 | | |
117 | 138 | | |
| |||
162 | 183 | | |
163 | 184 | | |
164 | 185 | | |
| 186 | + | |
165 | 187 | | |
166 | 188 | | |
167 | 189 | | |
| |||
216 | 238 | | |
217 | 239 | | |
218 | 240 | | |
219 | | - | |
| 241 | + | |
220 | 242 | | |
221 | 243 | | |
222 | 244 | | |
| |||
227 | 249 | | |
228 | 250 | | |
229 | 251 | | |
| 252 | + | |
230 | 253 | | |
231 | 254 | | |
232 | 255 | | |
233 | 256 | | |
234 | 257 | | |
235 | 258 | | |
236 | 259 | | |
237 | | - | |
238 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
239 | 266 | | |
240 | 267 | | |
241 | 268 | | |
242 | 269 | | |
243 | 270 | | |
244 | | - | |
| 271 | + | |
245 | 272 | | |
246 | | - | |
| 273 | + | |
247 | 274 | | |
248 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
249 | 286 | | |
250 | 287 | | |
251 | 288 | | |
| |||
259 | 296 | | |
260 | 297 | | |
261 | 298 | | |
262 | | - | |
263 | | - | |
264 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
265 | 310 | | |
266 | 311 | | |
267 | 312 | | |
0 commit comments