diff options
author | Liang Qi <liang.qi@qt.io> | 2019-09-13 13:30:41 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-09-13 14:04:47 +0200 |
commit | 14d2852597f7c869e91db2f54d954965af6083fb (patch) | |
tree | 035bccb3e28f31abef1b1e39a4ca384726d2fb76 /coin/provisioning/common/windows/helpers.ps1 | |
parent | 8c2ecdbc27532cf875cf47ce75654be98b3d7e20 (diff) | |
parent | 1eae3c41854294216e600f3f4a7dfc3987d30d0b (diff) |
Merge remote-tracking branch 'origin/dev' into wip/qt6
Conflicts:
.gitmodules
Ignore qtquick3d for now.
coin/platform_configs/default.txt
coin/platform_configs/default.yaml
coin/platform_configs/qtbase.txt
coin/platform_configs/qtbase.yaml
We use yaml files for configurations now.
Adjust the configurations for Qt6 as it was
done before in the .txt files.
Done-With: Alexandru Croitor <alexandru.croitor@qt.io>
Change-Id: Ica164f8865aed011c550ba7e1e8137e2bf9fdda9
Diffstat (limited to 'coin/provisioning/common/windows/helpers.ps1')
-rw-r--r-- | coin/provisioning/common/windows/helpers.ps1 | 48 |
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 ( |