aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/windows/helpers.ps1
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-08-20 14:07:34 +0200
committerLiang Qi <liang.qi@qt.io>2019-08-20 14:10:00 +0200
commit9a8fb868ec2c526325408a4cbf3e628aa3377e30 (patch)
treec5f319b851ce3c76664cd27133bfb874f265abd7 /coin/provisioning/common/windows/helpers.ps1
parentc63dd0ddfdf1467e2f08cb1c9769142be1420ca5 (diff)
parent42366fd7405f778d3b80f9de2f593ff18f52e0f9 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
This reverts commit d494d76c26df48c9cf3b45fc15ebad963fe34c52. Conflicts: coin/platform_configs/default.yaml Temporarily remove the -no-opengl build. coin/platform_configs/meta-boot2qt.yaml coin/platform_configs/qt5.yaml Temporarily remove the webassembly build on windows. coin/platform_configs/qtwebkit.yaml Task-number: QTQAINFRA-2577 Task-number: QTBUG-63917 Task-number: QTQAINFRA-2835 Done-With: Samuli Piippo <samuli.piippo@qt.io> Change-Id: Ia7972b481a5ce33febe26c6589db24578614b2fd
Diffstat (limited to 'coin/provisioning/common/windows/helpers.ps1')
-rw-r--r--coin/provisioning/common/windows/helpers.ps148
1 files changed, 46 insertions, 2 deletions
diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1
index 5a7eb674..100f14ae 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)"
}
@@ -136,6 +168,18 @@ function Add-Path
$Env:PATH = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
}
+function Prepend-Path
+{
+ Param (
+ [string]$Path
+ )
+ Write-Host "Adding $Path to Path"
+
+ $oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
+ [Environment]::SetEnvironmentVariable("Path", "$Path;" + $oldPath, [EnvironmentVariableTarget]::Machine)
+ $Env:PATH = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
+}
+
function Set-EnvironmentVariable
{
Param (