[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/3] Throw on build command failure instead of exiting
On Sat, Jul 5, 2025 at 6:00 PM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> wrote:
Exiting is not sufficient to signal the error condition in some cases
(as observed on CI).
Explicitly throw an error instead.
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
msbuild.ps1 | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/msbuild.ps1 b/msbuild.ps1
index 58053e2..d9785db 100644
--- a/msbuild.ps1
+++ b/msbuild.ps1
@@ -40,8 +40,7 @@ Function Run-MSBuild {
Invoke-_expression_ $c
if ($LASTEXITCODE -ne 0) {
- Write-Host -ForegroundColor Red "ERROR: MSBuild failed, code:" $LASTEXITCODE
- Exit $LASTEXITCODE
+ throw "ERROR: MSBuild failed, code: $LASTEXITCODE"
}
}
@@ -117,8 +116,7 @@ Function Run-CodeQL {
$b += $database
Invoke-_expression_ $b
if ($LASTEXITCODE -ne 0) {
- Write-Host -ForegroundColor Red "ERROR: CodeQL failed, code:" $LASTEXITCODE
- Exit $LASTEXITCODE
+ throw "ERROR: CodeQL failed, code: $LASTEXITCODE"
}
Remove-Item $bat
@@ -136,8 +134,7 @@ Function Run-CodeQL {
Invoke-_expression_ $c
if ($LASTEXITCODE -ne 0) {
- Write-Host -ForegroundColor Red "ERROR: CodeQL failed, code:" $LASTEXITCODE
- Exit $LASTEXITCODE
+ throw "ERROR: CodeQL failed, code: $LASTEXITCODE"
}
Copy-Item $sarif -Destination $SolutionPath
--
2.50.0.windows.2
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|