Skip to content

Commit fff8550

Browse files
authored
Fix Windows CLI integration deadlock in process wrapper (#38592)
1 parent 4078d4e commit fff8550

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/windows-cli-integration.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,16 @@ jobs:
124124
}
125125
126126
$proc = [System.Diagnostics.Process]::Start($psi)
127+
$stdoutTask = $proc.StandardOutput.ReadToEndAsync()
128+
$stderrTask = $proc.StandardError.ReadToEndAsync()
127129
if (-not $proc.WaitForExit($TimeoutMs)) {
128130
try { $proc.Kill($true) } catch {}
129131
throw "TIMEOUT: '$FilePath $($ArgumentList -join ' ')' exceeded ${TimeoutMs}ms"
130132
}
131133
132-
$stdout = $proc.StandardOutput.ReadToEnd()
133-
$stderr = $proc.StandardError.ReadToEnd()
134+
$proc.WaitForExit()
135+
$stdout = $stdoutTask.GetAwaiter().GetResult()
136+
$stderr = $stderrTask.GetAwaiter().GetResult()
134137
$output = "$stdout`n$stderr"
135138
136139
if ($AssertNoAnsi -and $output -match "\x1B\[[0-9;]*[A-Za-z]") {

0 commit comments

Comments
 (0)