From 6b8447593f8bb5c84f6178884ed263dce5b64ffe Mon Sep 17 00:00:00 2001 From: Rashil Gandhi Date: Tue, 8 Feb 2022 00:05:26 +0530 Subject: [PATCH 1/3] refactor(shim): Use `-file` instead of `-command` in ps1 script shims --- lib/core.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core.ps1 b/lib/core.ps1 index d238a8dfb5..d5683fce23 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -642,9 +642,9 @@ function shim($path, $global, $name, $arg) { "if !args! == !invalid! ( set args= )", "where /q pwsh.exe", "if %errorlevel% equ 0 (", - " pwsh -noprofile -ex unrestricted -command `"& '$resolved_path' $arg %args%;exit `$lastexitcode`"", + " pwsh -noprofile -ex unrestricted -file `"$resolved_path`" $arg %args%", ") else (", - " powershell -noprofile -ex unrestricted -command `"& '$resolved_path' $arg %args%;exit `$lastexitcode`"", + " powershell -noprofile -ex unrestricted -file `"$resolved_path`" $arg %args%", ")" ) -join "`r`n" | Out-File "$shim.cmd" -Encoding ASCII @@ -653,9 +653,9 @@ function shim($path, $global, $name, $arg) { "#!/bin/sh", "# $resolved_path", "if command -v pwsh.exe > /dev/null 2>&1; then", - " pwsh.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"", + " pwsh.exe -noprofile -ex unrestricted -file `"$resolved_path`" $arg $@", "else", - " powershell.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"", + " powershell.exe -noprofile -ex unrestricted -file `"$resolved_path`" $arg $@", "fi" ) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline } elseif ($path -match '\.jar$') { From ba60b0bb4fde8916c890c7c89a63fb80be83f564 Mon Sep 17 00:00:00 2001 From: Rashil Gandhi Date: Tue, 8 Feb 2022 00:48:34 +0530 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e93783b110..b7ac197852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - **diagnostic** Skip check for 'exclusionPath' if defender realtime protect is disabled ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699)) - **scoop-checkup** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699)) - **scoop-checkup** Separate defender issues, mark as performance problem instead potential problem ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699)) +- **shim** Use `-file` instead of `-command` in ps1 script shims ([#4721](https://github.com/ScoopInstaller/Scoop/pull/4721)) ### Builds From 636641641e981766d876bc6a0cddc68c2d0f2b01 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Tue, 8 Feb 2022 13:03:59 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7ac197852..53261354e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ - **diagnostic** Skip check for 'exclusionPath' if defender realtime protect is disabled ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699)) - **scoop-checkup** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699)) - **scoop-checkup** Separate defender issues, mark as performance problem instead potential problem ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699)) -- **shim** Use `-file` instead of `-command` in ps1 script shims ([#4721](https://github.com/ScoopInstaller/Scoop/pull/4721)) +- **shim:** Use `-file` instead of `-command` in ps1 script shims ([#4721](https://github.com/ScoopInstaller/Scoop/pull/4721)) ### Builds