zed/crates/util
Max Brunsfeld 2e20860461
Fix git hang caused by accidental inheritance of stdin FD (#57572)
When restarting Zed, I hit a bug where all Git operations were hung. I
realized that there was a hanging git process running `git cat-file
--batch-check=%(objectname)`. The process was waiting on stdin. This was
surprising, because [the
code](e2bbdb19b6/crates/git/src/repository.rs (L1665-L1709))
that spawns this process explicitly closes the pipe that is attached to
the process's stdin after writing a list of ref names.

Using Claude, I found that this could be caused by that pipe file
descriptor being cloned due to file descriptor inheritance when another
child process is `exec`'d while that stdin pipe is open. The fix is to
enhance our Darwin process spawning layer to set the close-on-exec flag
for the pipe file descriptors, so that they are not inherited by child
processes spawned using code paths that don't set
`POSIX_SPAWN_CLOEXEC_DEFAULT`.

Release Notes:

- Fixed a bug on macOS where Git operations could be blocked depending
on the timing of spawning child processes.
2026-05-25 16:20:30 +00:00
..
src Fix git hang caused by accidental inheritance of stdin FD (#57572) 2026-05-25 16:20:30 +00:00
Cargo.toml Remove std::fs::read_link in fs (#50974) 2026-03-14 20:02:34 -04:00
LICENSE-APACHE