mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-06 16:15:39 +00:00
fix(shim): Fix sh shim error in WSL (#4637)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
- **depends:** Check if extractor is available ([#4042](https://github.com/ScoopInstaller/Scoop/issues/4042))
|
||||
- **decompress:** Fix nested Zstd archive extraction ([#4608](https://github.com/ScoopInstaller/Scoop/issues/4608))
|
||||
- **shim:** Fix PS1 shim error when in different drive in PS7 ([#4614](https://github.com/ScoopInstaller/Scoop/issues/4614))
|
||||
- **shim:** Fix `sh` shim error in WSL ([#4637](https://github.com/ScoopInstaller/Scoop/issues/4637))
|
||||
|
||||
### Builds
|
||||
|
||||
|
||||
20
lib/core.ps1
20
lib/core.ps1
@@ -587,7 +587,7 @@ function shim($path, $global, $name, $arg) {
|
||||
"#!/bin/sh",
|
||||
"# $resolved_path",
|
||||
"MSYS2_ARG_CONV_EXCL=/C cmd.exe /C `"$resolved_path`" $arg `"$@`""
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline
|
||||
} elseif ($path -match '\.ps1$') {
|
||||
# if $path points to another drive resolve-path prepends .\ which could break shims
|
||||
warn_on_overwrite "$shim.ps1" $path
|
||||
@@ -635,12 +635,12 @@ function shim($path, $global, $name, $arg) {
|
||||
@(
|
||||
"#!/bin/sh",
|
||||
"# $resolved_path",
|
||||
"if command -v pwsh.exe &> /dev/null; then",
|
||||
" pwsh -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"",
|
||||
"if command -v pwsh.exe > /dev/null 2>&1; then",
|
||||
" pwsh.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"",
|
||||
"else",
|
||||
" powershell -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"",
|
||||
" powershell.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`"",
|
||||
"fi"
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline
|
||||
} elseif ($path -match '\.jar$') {
|
||||
warn_on_overwrite "$shim.cmd" $path
|
||||
@(
|
||||
@@ -652,8 +652,8 @@ function shim($path, $global, $name, $arg) {
|
||||
@(
|
||||
"#!/bin/sh",
|
||||
"# $resolved_path",
|
||||
"java -jar `"$resolved_path`" $arg `"$@`""
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII
|
||||
"java.exe -jar `"$resolved_path`" $arg `"$@`""
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline
|
||||
} elseif ($path -match '\.py$') {
|
||||
warn_on_overwrite "$shim.cmd" $path
|
||||
@(
|
||||
@@ -665,8 +665,8 @@ function shim($path, $global, $name, $arg) {
|
||||
@(
|
||||
"#!/bin/sh",
|
||||
"# $resolved_path",
|
||||
"python `"$resolved_path`" $arg `"$@`""
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII
|
||||
"python.exe `"$resolved_path`" $arg `"$@`""
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline
|
||||
} else {
|
||||
warn_on_overwrite "$shim.cmd" $path
|
||||
# find path to Git's bash so that batch scripts can run bash scripts
|
||||
@@ -684,7 +684,7 @@ function shim($path, $global, $name, $arg) {
|
||||
"#!/bin/sh",
|
||||
"# $resolved_path",
|
||||
"`"$resolved_path`" $arg `"$@`""
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII
|
||||
) -join "`n" | Out-File $shim -Encoding ASCII -NoNewline
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user