Content-Length: 296804 | pFad | http://github.com/npm/cli/commit/8794fd9161c29fea3f51ae8581f54172011d4069

1B fix(powershell): support pipeline input with Invoke-Expression (#8297) · npm/cli@8794fd9 · GitHub
Skip to content

Commit 8794fd9

Browse files
authored
fix(powershell): support pipeline input with Invoke-Expression (#8297)
1 parent c97ef8a commit 8794fd9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

bin/npm.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ if ($MyInvocation.Line) { # used "-Command" argument
3737

3838
# Support pipeline input
3939
if ($MyInvocation.ExpectingInput) {
40-
$input | Invoke-Expression "& `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS"
40+
$input = (@($input) -join "`n").Replace("``", "````")
41+
42+
Invoke-Expression "Write-Output `"$input`" | & `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS"
4143
} else {
4244
Invoke-Expression "& `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS"
4345
}

bin/npx.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ if ($MyInvocation.Line) { # used "-Command" argument
3737

3838
# Support pipeline input
3939
if ($MyInvocation.ExpectingInput) {
40-
$input | Invoke-Expression "& `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS"
40+
$input = (@($input) -join "`n").Replace("``", "````")
41+
42+
Invoke-Expression "Write-Output `"$input`" | & `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS"
4143
} else {
4244
Invoke-Expression "& `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS"
4345
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/npm/cli/commit/8794fd9161c29fea3f51ae8581f54172011d4069

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy