Skip to content

Fix file descriptor leak when process spawning failed on macOS - #59128

Merged
cole-miller merged 2 commits into
mainfrom
leaking-fds
Jun 11, 2026
Merged

Fix file descriptor leak when process spawning failed on macOS#59128
cole-miller merged 2 commits into
mainfrom
leaking-fds

Conversation

@cole-miller

Copy link
Copy Markdown
Member

Wrap the fds returned by create_pipe and open_dev_null in std::fs::File earlier, so that they are closed if we return early due to an error. Includes a regression test.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed a file descriptor leak on macOS.

cole-miller and others added 2 commits June 11, 2026 12:06
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 11, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 11, 2026
@cole-miller
cole-miller enabled auto-merge June 11, 2026 16:14
@cole-miller
cole-miller added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit e1bfcf8 Jun 11, 2026
43 checks passed
@cole-miller
cole-miller deleted the leaking-fds branch June 11, 2026 16:25
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…ndustries#59128)

Wrap the fds returned by `create_pipe` and `open_dev_null` in
`std::fs::File` earlier, so that they are closed if we return early due
to an error. Includes a regression test.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a file descriptor leak on macOS.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ndustries#59128)

Wrap the fds returned by `create_pipe` and `open_dev_null` in
`std::fs::File` earlier, so that they are closed if we return early due
to an error. Includes a regression test.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a file descriptor leak on macOS.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant