Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(win): drain both helper pipes at once instead of one after the other

Etienne Lescot378810e924e3
diff --git a/scripts/verify-appx-native.ps1 b/scripts/verify-appx-native.ps1
index 70b818e5d..f82b40722 100644
--- a/scripts/verify-appx-native.ps1
+++ b/scripts/verify-appx-native.ps1
@@ -140,12 +140,20 @@ public static extern System.IntPtr LoadLibraryExW(string path, System.IntPtr fil
$psi.RedirectStandardError = $true
$psi.CreateNoWindow = $true
$proc = [System.Diagnostics.Process]::Start($psi)
- $stdout = $proc.StandardOutput.ReadToEnd()
- $stderr = $proc.StandardError.ReadToEnd()
- $proc.WaitForExit(20000) | Out-Null
+ # Both pipes are started draining before anything blocks. Reading one to the
+ # end while the other fills its buffer deadlocks the pair: the child blocks
+ # writing to stderr, the parent blocks reading stdout, and the WaitForExit
+ # below never runs to break it. Today these print three words each, so the
+ # buffer never fills -- the hang would arrive the day a helper turns chatty,
+ # which is exactly when this check is earning its place.
+ $stdoutTask = $proc.StandardOutput.ReadToEndAsync()
+ $stderrTask = $proc.StandardError.ReadToEndAsync()
+ if (-not $proc.WaitForExit(20000)) { $proc.Kill() }
+ $stdout = $stdoutTask.GetAwaiter().GetResult()
+ $stderr = $stderrTask.GetAwaiter().GetResult()
$exitCode = "still running"
- if ($proc.HasExited) { $exitCode = $proc.ExitCode } else { $proc.Kill() }
+ if ($proc.HasExited) { $exitCode = $proc.ExitCode }
$said = ($stdout + $stderr).Trim()
$firstLine = ""
diff --git a/technical-documentation/engineering/build-and-packaging.md b/technical-documentation/engineering/build-and-packaging.md
index e5e8918ac..7ff612b84 100644
--- a/technical-documentation/engineering/build-and-packaging.md
+++ b/technical-documentation/engineering/build-and-packaging.md
@@ -70,7 +70,7 @@ This shipped: the 1.9.0 Store build loaded no compositor at all, so the editor o
That is not a theoretical image. Store certification runs on one, and it rejected 1.9.1:
-```
+```text
Error: Native Windows capture exited before recording started (code=3221225781)
```