Skip to content

Commit

Permalink
fix(shim): Remove character replacement in .cmd -> .ps1 shims
Browse files Browse the repository at this point in the history
Fix #4910.
  • Loading branch information
L. Yeung committed May 10, 2022
1 parent a822b87 commit 16824b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- **installed:** If no `$global`, check both local and global installed ([#4798](https://github.com/ScoopInstaller/Scoop/issues/4798))
- **shim:** Manipulating shims with UTF8 encoding ([#4791](https://github.com/ScoopInstaller/Scoop/issues/4791), [#4813](https://github.com/ScoopInstaller/Scoop/issues/4813))
- **shim:** Correctly quote $@ in sh->ps1 shims ([#4809](https://github.com/ScoopInstaller/Scoop/issues/4809))
- **shim:** Remove character replacement in .cmd -> .ps1 shims ([#4910](https://github.com/ScoopInstaller/Scoop/issues/4910))
- **update:** Skip logs starting with `(chore)` ([#4800](https://github.com/ScoopInstaller/Scoop/issues/4800))
- **scoop-download:** Add failure check ([#4822](https://github.com/ScoopInstaller/Scoop/issues/4822))
- **scoop-home:** Call `parse_app` for consistency ([#4910](https://github.com/ScoopInstaller/Scoop/issues/4910))
Expand Down
12 changes: 2 additions & 10 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -679,19 +679,11 @@ function shim($path, $global, $name, $arg) {
@(
"@rem $resolved_path",
"@echo off",
"setlocal enabledelayedexpansion",
"set args=%*",
":: replace problem characters in arguments",
"set args=%args:`"='%",
"set args=%args:(=``(%",
"set args=%args:)=``)%",
"set invalid=`"='",
"if !args! == !invalid! ( set args= )",
"where /q pwsh.exe",
"if %errorlevel% equ 0 (",
" pwsh -noprofile -ex unrestricted -file `"$resolved_path`" $arg %args%",
" pwsh -noprofile -ex unrestricted -file `"$resolved_path`" $arg %*",
") else (",
" powershell -noprofile -ex unrestricted -file `"$resolved_path`" $arg %args%",
" powershell -noprofile -ex unrestricted -file `"$resolved_path`" $arg %*",
")"
) -join "`r`n" | Out-UTF8File "$shim.cmd"

Expand Down

0 comments on commit 16824b3

Please sign in to comment.