Skip to content

Commit b516036

Browse files
committed
fix: use System.Diagnostics.Process for Windows smoke test
1 parent 77a6ca9 commit b516036

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/builds.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,28 @@ jobs:
159159
if: runner.os == 'Windows'
160160
shell: pwsh
161161
run: |
162+
$ErrorActionPreference = 'Continue'
162163
$examples = @('SimpleRoom', 'SimpleRpc', 'SimpleDataStream')
163164
$failed = $false
164165
foreach ($exe in $examples) {
165166
$exePath = "build/bin/Release/${exe}.exe"
166167
if (Test-Path $exePath) {
167168
Write-Host "Testing ${exe}..."
168169
# Capture output to verify program actually runs
169-
$output = & $exePath --help 2>&1
170-
# If there's no output, the program likely failed to start (e.g., missing DLL)
170+
# Use Start-Process to avoid PowerShell error handling issues
171+
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
172+
$pinfo.FileName = $exePath
173+
$pinfo.Arguments = "--help"
174+
$pinfo.RedirectStandardOutput = $true
175+
$pinfo.RedirectStandardError = $true
176+
$pinfo.UseShellExecute = $false
177+
$p = New-Object System.Diagnostics.Process
178+
$p.StartInfo = $pinfo
179+
$p.Start() | Out-Null
180+
$stdout = $p.StandardOutput.ReadToEnd()
181+
$stderr = $p.StandardError.ReadToEnd()
182+
$p.WaitForExit()
183+
$output = $stdout + $stderr
171184
if ([string]::IsNullOrWhiteSpace($output)) {
172185
Write-Host "ERROR: ${exe} produced no output - may have failed to start"
173186
$failed = $true
@@ -180,7 +193,7 @@ jobs:
180193
$failed = $true
181194
}
182195
}
183-
if ($failed) { exit 1 }
196+
if ($failed) { exit 1 } else { exit 0 }
184197
185198
- name: Upload build artifacts
186199
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)