Skip to content

Commit 3bb8a13

Browse files
committed
always scan for errors and write Logs output, regardless of Unity's exit code
1 parent 796e9fe commit 3bb8a13

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -962,13 +962,16 @@ function Start-UnityEditor {
962962

963963
$process = Start-Process @setProcessArgs
964964
if ( $Wait ) {
965-
if ( $process.ExitCode -ne 0 ) {
966-
if ( $LogFile -and (Test-Path $LogFile -Type Leaf) ) {
967-
Write-UnityErrors $LogFile
968-
Write-Verbose "Writing $LogFile to Information stream Tagged as 'Logs'"
969-
Get-Content $LogFile | ForEach-Object { Write-Information -MessageData $_ -Tags 'Logs' }
970-
}
965+
if ( $LogFile -and (Test-Path $LogFile -Type Leaf) ) {
966+
# Note that Unity sometimes returns a success ExitCode despite the presence of errors, but we want
967+
# to make sure that we flag such errors.
968+
Write-UnityErrors $LogFile
969+
970+
Write-Verbose "Writing $LogFile to Information stream Tagged as 'Logs'"
971+
Get-Content $LogFile | ForEach-Object { Write-Information -MessageData $_ -Tags 'Logs' }
972+
}
971973

974+
if ( $process.ExitCode -ne 0 ) {
972975
Write-Error "Unity quit with non-zero exit code: $($process.ExitCode)"
973976
}
974977
}
@@ -1012,7 +1015,6 @@ function Get-IsUnityError {
10121015
return $true
10131016
}
10141017

1015-
10161018
# In the future, additional kinds of errors that can be found in Unity logs could be added here:
10171019
# ...
10181020

0 commit comments

Comments
 (0)