Do not exit cleanly after failed `msbuild` in `build.ps1`'s `finally` block
- part of aspnet/AspNetCore-Internal#2665 - should surface errors we're currently hiding Also increase PowerShell logging to help debug build and test hangs nit: Run `finally` block after catching an exception
This commit is contained in:
parent
495f52920c
commit
5ce20ebdde
13
build.ps1
13
build.ps1
|
|
@ -324,6 +324,7 @@ if ($tmpBinaryLog) {
|
|||
# Capture MSBuild crash logs
|
||||
$env:MSBUILDDEBUGPATH = $LogDir
|
||||
|
||||
$local:exit_code = $null
|
||||
try {
|
||||
# Import custom tools configuration, if present in the repo.
|
||||
# Note: Import in global scope so that the script set top-level variables without qualification.
|
||||
|
|
@ -342,6 +343,10 @@ try {
|
|||
|
||||
$restore = $tmpRestore
|
||||
|
||||
if ($ci) {
|
||||
$global:VerbosePreference = 'Continue'
|
||||
}
|
||||
|
||||
if (-not $NoBuildRepoTasks) {
|
||||
MSBuild $toolsetBuildProj `
|
||||
/p:RepoRoot=$RepoRoot `
|
||||
|
|
@ -359,9 +364,13 @@ try {
|
|||
catch {
|
||||
Write-Host $_.ScriptStackTrace
|
||||
Write-PipelineTaskError -Message $_
|
||||
ExitWithExitCode 1
|
||||
$exit_code = 1
|
||||
}
|
||||
finally {
|
||||
if (! $exit_code) {
|
||||
$exit_code = $LASTEXITCODE
|
||||
}
|
||||
|
||||
# tools.ps1 corrupts global state, so reset these values so they don't carry between invocations of build.ps1
|
||||
rm variable:global:_BuildTool -ea Ignore
|
||||
rm variable:global:_DotNetInstallDir -ea Ignore
|
||||
|
|
@ -378,4 +387,4 @@ finally {
|
|||
}
|
||||
}
|
||||
|
||||
ExitWithExitCode 0
|
||||
ExitWithExitCode $exit_code
|
||||
|
|
|
|||
Loading…
Reference in New Issue