aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/windows/helpers.ps1
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-08-06 11:46:15 +0200
committerLiang Qi <liang.qi@qt.io>2019-08-06 11:46:15 +0200
commit13b206662bf3c3cb5eaf2e977d457fd1a7c3fa50 (patch)
tree7e7ea027376ad0dbf9f5f65ae18e03e0f30cde5f /coin/provisioning/common/windows/helpers.ps1
parenta268fb46895f694a58da2389fd47ca393a68deef (diff)
parent2fb0e4f3521327d7d44b012316fb9e79c11f4366 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.13.1
Notice - qtvirtualkeyboard and qtwebengine got ignored temporarily due to issues on QEMU. Conflicts: .gitmodules Change-Id: Iefab0fa5172c976ca06b3f33772c4c4bc10763c2
Diffstat (limited to 'coin/provisioning/common/windows/helpers.ps1')
-rw-r--r--coin/provisioning/common/windows/helpers.ps136
1 files changed, 34 insertions, 2 deletions
diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1
index 6e8e0365..ba35f6b5 100644
--- a/coin/provisioning/common/windows/helpers.ps1
+++ b/coin/provisioning/common/windows/helpers.ps1
@@ -22,14 +22,46 @@ function Run-Executable
[string]$Executable=$(throw("You must specify a program to run.")),
[string[]]$Arguments
)
+
+ $stdoutFile = [System.IO.Path]::GetTempFileName()
+ $stderrFile = [System.IO.Path]::GetTempFileName()
+
if ([string]::IsNullOrEmpty($Arguments)) {
Write-Host "Running `"$Executable`""
- $p = Start-Process -FilePath "$Executable" -Wait -PassThru
+ $p = Start-Process -FilePath "$Executable" -Wait -PassThru `
+ -RedirectStandardOutput $stdoutFile -RedirectStandardError $stderrFile
} else {
Write-Host "Running `"$Executable`" with arguments `"$Arguments`""
- $p = Start-Process -FilePath "$Executable" -ArgumentList $Arguments -PassThru
+ $p = Start-Process -FilePath "$Executable" -ArgumentList $Arguments -PassThru `
+ -RedirectStandardOutput $stdoutFile -RedirectStandardError $stderrFile
Wait-Process -InputObject $p
}
+
+ $stdoutContent = [System.IO.File]::ReadAllText($stdoutFile)
+ $stderrContent = [System.IO.File]::ReadAllText($stderrFile)
+ Remove-Item -Path $stdoutFile, $stderrFile -Force -ErrorAction Ignore
+
+ $hasOutput = $false
+ if ([string]::IsNullOrEmpty($stdoutContent) -eq $false -or [string]::IsNullOrEmpty($stderrContent) -eq $false) {
+ $hasOutput = $true
+ Write-Host
+ Write-Host "======================================================================"
+ }
+ if ([string]::IsNullOrEmpty($stdoutContent) -eq $false) {
+ Write-Host "stdout of `"$Executable`":"
+ Write-Host "======================================================================"
+ Write-Host $stdoutContent
+ Write-Host "======================================================================"
+ }
+ if ([string]::IsNullOrEmpty($stderrContent) -eq $false) {
+ Write-Host "stderr of `"$Executable`":"
+ Write-Host "======================================================================"
+ Write-Host $stderrContent
+ Write-Host "======================================================================"
+ }
+ if ($hasOutput) {
+ Write-Host
+ }
if ($p.ExitCode -ne 0) {
throw "Process $($Executable) exited with exit code $($p.ExitCode)"
}