Skip to content

Commit

Permalink
Fixes for older VS2019 versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ndabas committed Jul 17, 2021
1 parent dca35dc commit ebfb49f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ function exec {
$ErrorActionPreference = 'Continue'
$global:LASTEXITCODE = 0

# Convert stderr in ErrorRecord objects back to strings
& $private:cmd 2>&1 | ForEach-Object { "$_" }
try {
# Convert stderr in ErrorRecord objects back to strings
& $cmd 2>&1 | ForEach-Object { "$_" }

$ErrorActionPreference = $private:eap

if ($global:LASTEXITCODE -ne 0) {
Write-Error "Command '$private:cmd' exited with code $LASTEXITCODE"
if ($LASTEXITCODE -ne 0) {
throw "Command '$cmd' exited with code $LASTEXITCODE"
}
}
finally {
$ErrorActionPreference = $eap
}
}
2 changes: 1 addition & 1 deletion pico-env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ call :AddToPath "%ProgramFiles%\Microsoft Visual Studio\Installer"

rem https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt

for /f "usebackq delims=" %%i in (`vswhere.exe -products * -requires "Microsoft.VisualStudio.Component.VC.CoreIde" -latest -property installationPath`) do (
for /f "usebackq delims=" %%i in (`vswhere.exe -products * -requires "Microsoft.VisualStudio.Component.VC.Tools.x86.x64" -latest -property installationPath`) do (
if exist "%%i\Common7\Tools\vsdevcmd.bat" (
call "%%i\Common7\Tools\vsdevcmd.bat"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/setup-oldvs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ $elapsed = Measure-Command { $process = Start-Process -FilePath ".\installers\$f
Write-Host ("Finished in {0:hh':'mm':'ss}" -f $elapsed)

if ($process.ExitCode -ne 0) {
Write-Host "Install failed with exit code $($process.ExitCode)"
throw "Install failed with exit code $($process.ExitCode)"
exit $process.ExitCode
}

0 comments on commit ebfb49f

Please sign in to comment.