From 2b4320fa301c7f1963f0a508c6e0b1ac58a4222e Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 26 Aug 2025 09:01:34 -0400 Subject: [PATCH 1/4] fix(powershell): fix issue when InvocationName = "&" --- bin/npm.ps1 | 2 +- bin/npx.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/npm.ps1 b/bin/npm.ps1 index 4e4aaa78c87ca..7ad184346c6db 100644 --- a/bin/npm.ps1 +++ b/bin/npm.ps1 @@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPM_CLI_JS) { if ($MyInvocation.ExpectingInput) { # takes pipeline input $input | & $NODE_EXE $NPM_CLI_JS $args -} elseif (-not $MyInvocation.Line) { # used "-File" argument +} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -eq "&") { # used "-File" argument & $NODE_EXE $NPM_CLI_JS $args } else { # used "-Command" argument if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) { diff --git a/bin/npx.ps1 b/bin/npx.ps1 index 05c76825e0d01..aca0cd8b77b52 100644 --- a/bin/npx.ps1 +++ b/bin/npx.ps1 @@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPX_CLI_JS) { if ($MyInvocation.ExpectingInput) { # takes pipeline input $input | & $NODE_EXE $NPX_CLI_JS $args -} elseif (-not $MyInvocation.Line) { # used "-File" argument +} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -eq "&") { # used "-File" argument & $NODE_EXE $NPX_CLI_JS $args } else { # used "-Command" argument if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) { From 3f2a47a15ca5d71f3bf346d42695a7d81a4ad8a5 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 26 Aug 2025 12:16:38 -0400 Subject: [PATCH 2/4] empty commit for CI From a1564258e46604f55a5df851e01ac00bddf71691 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 26 Aug 2025 12:58:44 -0400 Subject: [PATCH 3/4] also check "." and empty InvocationName's --- bin/npm.ps1 | 2 +- bin/npx.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/npm.ps1 b/bin/npm.ps1 index 7ad184346c6db..851a7ab561c8d 100644 --- a/bin/npm.ps1 +++ b/bin/npm.ps1 @@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPM_CLI_JS) { if ($MyInvocation.ExpectingInput) { # takes pipeline input $input | & $NODE_EXE $NPM_CLI_JS $args -} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -eq "&") { # used "-File" argument +} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.', '') { # used "-File" argument & $NODE_EXE $NPM_CLI_JS $args } else { # used "-Command" argument if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) { diff --git a/bin/npx.ps1 b/bin/npx.ps1 index aca0cd8b77b52..29a3d4b994e7e 100644 --- a/bin/npx.ps1 +++ b/bin/npx.ps1 @@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPX_CLI_JS) { if ($MyInvocation.ExpectingInput) { # takes pipeline input $input | & $NODE_EXE $NPX_CLI_JS $args -} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -eq "&") { # used "-File" argument +} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.', '') { # used "-File" argument & $NODE_EXE $NPX_CLI_JS $args } else { # used "-Command" argument if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) { From 1b932961cb764048ab10d485ecf6edeaca548f1d Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 26 Aug 2025 13:21:05 -0400 Subject: [PATCH 4/4] don't need case when it is empty --- bin/npm.ps1 | 2 +- bin/npx.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/npm.ps1 b/bin/npm.ps1 index 851a7ab561c8d..e18a672625354 100644 --- a/bin/npm.ps1 +++ b/bin/npm.ps1 @@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPM_CLI_JS) { if ($MyInvocation.ExpectingInput) { # takes pipeline input $input | & $NODE_EXE $NPM_CLI_JS $args -} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.', '') { # used "-File" argument +} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.') { # used "-File" argument & $NODE_EXE $NPM_CLI_JS $args } else { # used "-Command" argument if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) { diff --git a/bin/npx.ps1 b/bin/npx.ps1 index 29a3d4b994e7e..60ba47ba39641 100644 --- a/bin/npx.ps1 +++ b/bin/npx.ps1 @@ -26,7 +26,7 @@ if (Test-Path $NPM_PREFIX_NPX_CLI_JS) { if ($MyInvocation.ExpectingInput) { # takes pipeline input $input | & $NODE_EXE $NPX_CLI_JS $args -} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.', '') { # used "-File" argument +} elseif (-not $MyInvocation.Line -or $MyInvocation.InvocationName -in '&', '.') { # used "-File" argument & $NODE_EXE $NPX_CLI_JS $args } else { # used "-Command" argument if (($MyInvocation | Get-Member -Name 'Statement') -and $MyInvocation.Statement) {