Skip to content

Commit 5f18557

Browse files
authored
fix(powershell): fix issue with modified InvocationName (#8532)
Fixes #8528
1 parent 208c06e commit 5f18557

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin/npm.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPM_CLI_JS) {
2626

2727
if ($MyInvocation.ExpectingInput) { # takes pipeline input
2828
$input | & $NODE_EXE $NPM_CLI_JS $args
29-
} elseif (-not $MyInvocation.Line) { # used "-File" argument
29+
} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.') { # used "-File" argument
3030
& $NODE_EXE $NPM_CLI_JS $args
3131
} else { # used "-Command" argument
3232
if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) {

bin/npx.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPX_CLI_JS) {
2626

2727
if ($MyInvocation.ExpectingInput) { # takes pipeline input
2828
$input | & $NODE_EXE $NPX_CLI_JS $args
29-
} elseif (-not $MyInvocation.Line) { # used "-File" argument
29+
} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.') { # used "-File" argument
3030
& $NODE_EXE $NPX_CLI_JS $args
3131
} else { # used "-Command" argument
3232
if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) {

0 commit comments

Comments
 (0)