Skip to content

Commit

Permalink
fix(shim): Remove character replacement in .cmd -> .ps1 shims (ScoopI…
Browse files Browse the repository at this point in the history
  • Loading branch information
L. Yeung authored May 17, 2022
1 parent f49f976 commit bb5392b
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 @@ -6,6 +6,7 @@
- **depends:** Avoid digits in archive file extension (except for .7z and .001) ([#4915](https://github.com/ScoopInstaller/Scoop/issues/4915))
- **bucket:** Don't check remote URL of non-git buckets ([#4923](https://github.com/ScoopInstaller/Scoop/issues/4923))
- **bucket:** Don't write message OK before bucket is cloned ([#4925](https://github.com/ScoopInstaller/Scoop/issues/4925))
- **shim:** Remove character replacement in .cmd -> .ps1 shims ([#4914](https://github.com/ScoopInstaller/Scoop/issues/4914))

### Documentation

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 bb5392b

Please sign in to comment.