tools/testbuild.ps1: Windows fix the redirect error stream

Windows cmake fix the redirect error stream
This commit is contained in:
simbit18 2025-06-17 16:56:49 +02:00 committed by Xiang Xiao
parent 6c1781d523
commit 3cc7b29866

View file

@ -270,12 +270,19 @@ function build_cmake {
# Build the project
try {
if (cmake --build build 1> $null) {
cmake --build build
$global:fail = 1
$errorcmakelist = @()
# $ErrorActionPreference = 'Stop'
$ErrorActionPreference = "Continue"
$errorcmakelist = (cmake --build build 2>$null)
if ($lastExitCode -ne 0) {
foreach ($errorline in $errorcmakelist) {
Write-Host "$errorline"
}
}
else {
Write-Host " Build completed successfully."
}
}
catch {
Write-Error "Build failed: $_"
$global:fail = 1
@ -300,6 +307,7 @@ function build_cmake {
}
catch {
Write-Host " An error occurred while copying files: $_" -ForegroundColor Red
$global:fail = 1
}
}
}
@ -307,7 +315,7 @@ function build_cmake {
function build {
Write-Host " Building NuttX..."
if ($cmake) {
Write-Host " build_cmake" -ForegroundColor Green
# Write-Host " build_cmake" -ForegroundColor Green
build_cmake
}
else {
@ -337,7 +345,7 @@ function refresh_cmake {
Write-Host " Refresh completed successfully."
}
catch {
Write-Error "refresh failed: $_"
Write-Error "Refresh failed: $_"
$global:fail = 1
}
@ -496,5 +504,8 @@ foreach ($line in $testlist) {
}
Write-Host "------------------------------------------------------------------------------------"
$timestamp = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
Write-Host "End: $timestamp" -ForegroundColor Yellow
Write-Host "===================================================================================="
exit $global:fail