fix-deviant(os): always reap the URL opener child process
Intentional deviation from Ghostty 1.3.1 (DEVIANT_FIXES.md row 32). Zig's os/open.zig runs `try collectOutput(...)` before `wait()`: when collection fails (e.g. a stream exceeds the 50 KiB limit), the error returns early and the child is never waited for, leaving a zombie process for the lifetime of Ghostty. The Rust opener thread now always waits for the child (the pipes are already closed at that point) and still logs the collection error. Test Plan: - cargo test -p ghostty-os open
This commit is contained in:
1 parent
65dd9d579f
commit
4a55abf1c1
2 files changed
+7
-2
No files matched your search
@@ -147,14 +147,18 @@ fn collect_output(child: &mut Child) -> io::Result<(Vec<u8>, Vec<u8>)> {
|
||||
}
|
||||
|
||||
fn open_thread(mut child: Child) {
|
||||
let stderr = match collect_output(&mut child) {
|
||||
let collected = collect_output(&mut child);
|
||||
// Zig's `try collectOutput` skips `wait` on error; reap anyway so the
|
||||
// child does not stay a zombie (the pipes are closed by now).
|
||||
let waited = child.wait();
|
||||
let stderr = match collected {
|
||||
Ok((_stdout, stderr)) => stderr,
|
||||
Err(e) => {
|
||||
log::warn!("error collecting open command output err={e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
if let Err(e) = child.wait() {
|
||||
if let Err(e) = waited {
|
||||
log::warn!("error waiting for open command err={e}");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user