diff --git a/src/functions/Chocolatey-Pack.ps1 b/src/functions/Chocolatey-Pack.ps1 index c697443..78ee7ab 100644 --- a/src/functions/Chocolatey-Pack.ps1 +++ b/src/functions/Chocolatey-Pack.ps1 @@ -10,7 +10,8 @@ param( Write-Host "Calling `'$nugetExe $packageArgs`'." - Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile + $process = Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile -PassThru + if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process } $nugetOutput = Get-Content $logFile -Encoding Ascii foreach ($line in $nugetOutput) { diff --git a/src/functions/Chocolatey-Push.ps1 b/src/functions/Chocolatey-Push.ps1 index 3873515..616cabd 100644 --- a/src/functions/Chocolatey-Push.ps1 +++ b/src/functions/Chocolatey-Push.ps1 @@ -17,7 +17,8 @@ param( Write-Host "Calling `'$nugetExe $packageArgs`'. This may take a few minutes. Please wait for the command to finish." -ForegroundColor $Note -BackgroundColor Black - Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile + $process = Start-Process $nugetExe -ArgumentList $packageArgs -NoNewWindow -Wait -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile -PassThru + if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process } $nugetOutput = Get-Content $logFile -Encoding Ascii foreach ($line in $nugetOutput) { diff --git a/src/functions/Chocolatey-Python.ps1 b/src/functions/Chocolatey-Python.ps1 index b166404..fd1ea07 100644 --- a/src/functions/Chocolatey-Python.ps1 +++ b/src/functions/Chocolatey-Python.ps1 @@ -36,8 +36,9 @@ param( #& cmd.exe $packagesArgs | Tee-Object -FilePath $chocoInstallLog Write-Host "Opening minimized PowerShell window and calling `'cmd.exe $packageArgs`'. If progress is taking a long time, please check that window. It also may not be 100% silent..." -ForegroundColor $Warning -BackgroundColor Black - Start-Process -FilePath "$($env:windir)\System32\WindowsPowerShell\v1.0\powershell.exe" -ArgumentList "-NoProfile -ExecutionPolicy unrestricted -Command `"cmd.exe $packageArgs | Tee-Object -FilePath `'$chocoInstallLog`'`"" -Wait -WindowStyle Minimized - + $process = Start-Process -FilePath "$($env:windir)\System32\WindowsPowerShell\v1.0\powershell.exe" -ArgumentList "-NoProfile -ExecutionPolicy unrestricted -Command `"cmd.exe $packageArgs | Tee-Object -FilePath `'$chocoInstallLog`'`"" -Wait -WindowStyle Minimized -PassThru + if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process } + Create-InstallLogIfNotExists $chocoInstallLog $installOutput = Get-Content $chocoInstallLog -Encoding Ascii foreach ($line in $installOutput) { diff --git a/src/helpers/functions/Get-CheckSumValid.ps1 b/src/helpers/functions/Get-CheckSumValid.ps1 index 3bfc9ac..f9cc810 100644 --- a/src/helpers/functions/Get-CheckSumValid.ps1 +++ b/src/helpers/functions/Get-CheckSumValid.ps1 @@ -20,6 +20,7 @@ param( Write-Debug "Calling command [`'$checksumExe`' -c$checksum `"$file`"] to retrieve checksum" $process = Start-Process "$checksumExe" -ArgumentList " -c=`"$checksum`" -t=`"$checksumType`" -f=`"$file`"" -Wait -WindowStyle Hidden -PassThru + if ($host.Version.Major -ge 3) { Wait-Process -InputObject $process } Write-Debug "`'$checksumExe`' exited with $($process.ExitCode)" diff --git a/src/helpers/functions/Get-ChocolateyUnzip.ps1 b/src/helpers/functions/Get-ChocolateyUnzip.ps1 index 2b6263d..e1662af 100644 --- a/src/helpers/functions/Get-ChocolateyUnzip.ps1 +++ b/src/helpers/functions/Get-ChocolateyUnzip.ps1 @@ -80,7 +80,7 @@ param( $unzipOps = { param($7zip, $destination, $fileFullPath, [ref]$exitCodeRef) $p = Start-Process $7zip -ArgumentList "x -o`"$destination`" -y `"$fileFullPath`"" -Wait -WindowStyle Hidden -PassThru - Wait-Process -InputObject $p + if ($host.Version.Major -ge 3) { Wait-Process -InputObject $p } $exitCodeRef.Value = $p.ExitCode }