Follow-up from a wintty-bench containment audit (see deblasis/wintty-bench#5). wintty-bench now wraps its launched Wintty process in a Windows JobObject with KILL_ON_JOB_CLOSE, which catches orphan shells re-parented to PID 0 on abort. The audit found two latent spots in this repo that don't leak today but would silently break under plausible future changes.
1. Ghostty.Bench/Transports/DirectPipeTransport.cs
Spawns EchoChild.exe via Process.Start and cleans up with Process.Kill(entireProcessTree: true) around line 58. EchoChild is a leaf binary today with no grandchildren, so the Kill works. If anyone replaces EchoChild with a shell wrapper (pwsh/cmd) the cleanup silently fails on Windows because entireProcessTree walks parent-PID links at kill time, and re-parented orphans are unreachable.
Fix: wrap the Process in a JobObject before Process.Start and dispose the job on cleanup. Reference implementation: harness/Launchers/WinttyJobObject.cs in deblasis/wintty-bench. About 30 lines of P/Invoke plus an assign-at-start line.
2. harness/Launchers/WtLauncher.cs (wintty-bench)
Not actually in this repo, but worth calling out for symmetry: WtLauncher launches Windows Terminal via its MSIX entry, and MSIX apps cannot be added to a JobObject. It already degrades to Process.Kill(entireProcessTree) via LaunchHandle.Dispose, which is the best we can do. A one-line code comment noting the MSIX constraint would prevent anyone pattern-matching against WinttyLauncher and filing this as a bug.
Will file the WtLauncher comment in deblasis/wintty-bench directly; this issue tracks only item # 1.
Priority
Low. No observed leaks. Nice-to-have hardening for future-proofing the ConPTY bench harness.
Follow-up from a wintty-bench containment audit (see deblasis/wintty-bench#5). wintty-bench now wraps its launched Wintty process in a Windows JobObject with KILL_ON_JOB_CLOSE, which catches orphan shells re-parented to PID 0 on abort. The audit found two latent spots in this repo that don't leak today but would silently break under plausible future changes.
1.
Ghostty.Bench/Transports/DirectPipeTransport.csSpawns
EchoChild.exeviaProcess.Startand cleans up withProcess.Kill(entireProcessTree: true)around line 58.EchoChildis a leaf binary today with no grandchildren, so theKillworks. If anyone replacesEchoChildwith a shell wrapper (pwsh/cmd) the cleanup silently fails on Windows becauseentireProcessTreewalks parent-PID links at kill time, and re-parented orphans are unreachable.Fix: wrap the
Processin a JobObject beforeProcess.Startand dispose the job on cleanup. Reference implementation:harness/Launchers/WinttyJobObject.csin deblasis/wintty-bench. About 30 lines of P/Invoke plus an assign-at-start line.2.
harness/Launchers/WtLauncher.cs(wintty-bench)Not actually in this repo, but worth calling out for symmetry:
WtLauncherlaunches Windows Terminal via its MSIX entry, and MSIX apps cannot be added to a JobObject. It already degrades toProcess.Kill(entireProcessTree)viaLaunchHandle.Dispose, which is the best we can do. A one-line code comment noting the MSIX constraint would prevent anyone pattern-matching againstWinttyLauncherand filing this as a bug.Will file the WtLauncher comment in deblasis/wintty-bench directly; this issue tracks only item # 1.
Priority
Low. No observed leaks. Nice-to-have hardening for future-proofing the ConPTY bench harness.