From b0e0d6baee7b8a66e9b68f765995cacc21905115 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Thu, 18 Feb 2021 16:03:05 +0000 Subject: [PATCH] Embed build output directly in console --- ue4-build.ps1 | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/ue4-build.ps1 b/ue4-build.ps1 index 1481a0d..a8e81ca 100644 --- a/ue4-build.ps1 +++ b/ue4-build.ps1 @@ -58,6 +58,8 @@ $result = 0 try { if ($src -ne ".") { Push-Location $src } + Write-Output "-- Build process starting --" + # Locate UE4 project file $uprojfile = Get-ChildItem *.uproject | Select-Object -expand Name if (-not $uprojfile) { @@ -131,31 +133,10 @@ try { } else { Write-Verbose "Running $buildbat $buildargs" - $pinfo = New-Object System.Diagnostics.ProcessStartInfo - $pinfo.FileName = $buildbat - $pinfo.RedirectStandardError = $true - $pinfo.RedirectStandardOutput = $true - $pinfo.UseShellExecute = $false - $pinfo.Arguments = $buildargs - $process = New-Object System.Diagnostics.Process - $process.StartInfo = $pinfo - $process.Start() | Out-Null - - Write-Host "UE4 Build: " -NoNewline - do { - Write-Host "." -NoNewline - start-sleep -Milliseconds 1000 - } until ($process.HasExited) - Write-Host "." - - if ($process.ExitCode -ne 0) { - $code = $process.ExitCode - Write-Output $process.StandardOutput.ReadToEnd() - Write-Output $process.StandardError.ReadToEnd() + $proc = Start-Process $buildbat $buildargs -Wait -PassThru -NoNewWindow + if ($proc.ExitCode -ne 0) { + $code = $proc.ExitCode throw "*** Build exited with code $code, see above" - } else { - Write-Verbose $process.StandardOutput.ReadToEnd() - Write-Output "---- UE4 Build OK ----" } }