From 2ec00d576c7e594dc5c0f1eac4536c5310ce6f17 Mon Sep 17 00:00:00 2001 From: Rashil Gandhi Date: Sat, 4 Dec 2021 02:05:15 +0530 Subject: [PATCH] fix(shim): Specify command arg for bash - fix #3878 --- lib/core.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core.ps1 b/lib/core.ps1 index 2fb64edb62..1dccea5a1b 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -624,9 +624,9 @@ if %errorlevel% equ 0 ( "#!/bin/sh # $resolved_path if command -v pwsh.exe &> /dev/null; then - pwsh.exe -noprofile -ex unrestricted `"$resolved_path`" $arg `"$@`" + pwsh.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`" else - powershell.exe -noprofile -ex unrestricted `"$resolved_path`" $arg `"$@`" + powershell.exe -noprofile -ex unrestricted -command `"& '$resolved_path' $arg $@;exit \`$lastexitcode`" fi" | Out-File $shim -Encoding ASCII } elseif ($path -match '\.jar$') { warn_on_overwrite "$shim.cmd" $path