Skip to content

Commit 81e2095

Browse files
rashil2000niheaven
authored andcommittedMar 8, 2022
refactor(shim): Use -file instead of -command in ps1 script shims (ScoopInstaller#4721)
* refactor(shim): Use `-file` instead of `-command` in ps1 script shims * update changelog * Update CHANGELOG.md Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
1 parent ced841e commit 81e2095

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
- **diagnostic** Skip check for 'exclusionPath' if defender realtime protect is disabled ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699))
4040
- **scoop-checkup** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699))
4141
- **scoop-checkup** Separate defender issues, mark as performance problem instead potential problem ([#4699](https://github.com/ScoopInstaller/Scoop/pull/4699))
42+
- **shim:** Use `-file` instead of `-command` in ps1 script shims ([#4721](https://github.com/ScoopInstaller/Scoop/pull/4721))
4243

4344
### Builds
4445

‎lib/core.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,9 @@ function shim($path, $global, $name, $arg) {
642642
"if !args! == !invalid! ( set args= )",
643643
"where /q pwsh.exe",
644644
"if %errorlevel% equ 0 (",
645-
" pwsh -noprofile -ex unrestricted -command `"& '$resolved_path' $arg %args%;exit `$lastexitcode`"",
645+
" pwsh -noprofile -ex unrestricted -file `"$resolved_path`" $arg %args%",
646646
") else (",
647-
" powershell -noprofile -ex unrestricted -command `"& '$resolved_path' $arg %args%;exit `$lastexitcode`"",
647+
" powershell -noprofile -ex unrestricted -file `"$resolved_path`" $arg %args%",
648648
")"
649649
) -join "`r`n" | Out-File "$shim.cmd" -Encoding ASCII
650650

@@ -653,9 +653,9 @@ function shim($path, $global, $name, $arg) {
653653
"#!/bin/sh",
654654
"# $resolved_path",
655655
"if command -v pwsh.exe > /dev/null 2>&1; then",
656-
" pwsh.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"",
656+
" pwsh.exe -noprofile -ex unrestricted -file `"$resolved_path`" $arg $@",
657657
"else",
658-
" powershell.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"",
658+
" powershell.exe -noprofile -ex unrestricted -file `"$resolved_path`" $arg $@",
659659
"fi"
660660
) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline
661661
} elseif ($path -match '\.jar$') {

0 commit comments

Comments
 (0)