Use ExitStatus in ChildExit event#8825
Merged
chrisduerr merged 5 commits intoalacritty:masterfrom Jan 29, 2026
Merged
Conversation
chrisduerr
requested changes
Jan 22, 2026
smitbarmase
added a commit
to zed-industries/zed
that referenced
this pull request
Jan 25, 2026
…47420) Closes #38168 Closes #42414 We were already using `ExitStatusExt::from_raw()` to construct an `ExitStatus`, but we were passing in the exit code from alacritty_terminal's `ChildExit` event. This worked fine on Windows where `from_raw()` expects an exit code, but on Unix, `from_raw()` ([read more](https://doc.rust-lang.org/std/os/unix/process/trait.ExitStatusExt.html#tymethod.from_raw)) expects a raw wait status from `waitpid()` and not an exit code. When a child process was killed by a signal (e.g., SIGSEGV), `ExitStatus::code()` returns `None` since only normal exits have an exit code. This caused the terminal to hang because we weren't properly detecting the exit. One fix would have been to remove the dependency on `ExitStatus` entirely, but using the raw wait status gives us more information, we can now detect exit codes, signal terminations, and more. The actual fix was upstream in `alacritty_terminal` to send the raw wait status instead of just the exit code. Currently using forked patch https://github.com/zed-industries/alacritty/tree/v0.16-child-exit-patch which is based on v0.25.1. Upstream PR: alacritty/alacritty#8825 Release Notes: - Fixed terminal hanging when a child process is killed by a signal (e.g., SIGSEGV from null pointer dereference).
Contributor
Author
|
Tested on Windows and macOS, works well with the downstream changes. Ready for review when you get a chance. |
chrisduerr
approved these changes
Jan 29, 2026
Comment on lines
+83
to
+84
| /// Indicates the child has exited. | ||
| Exited(Option<ExitStatus>), |
Member
There was a problem hiding this comment.
Just as an observation: Windows is the only reason why this needs to be an Option at this point. I'd be surprised if this was ever actually None in practice.
| Event::Bell => write!(f, "Bell"), | ||
| Event::Exit => write!(f, "Exit"), | ||
| Event::ChildExit(code) => write!(f, "ChildExit({code})"), | ||
| Event::ChildExit(status) => write!(f, "ChildExit({status:?})"), |
Member
There was a problem hiding this comment.
This is what this formats as: ChildExit(ExitStatus(unix_wait_status(120))). I think for a debug format that's probably fine since the STD internals are pretty clear here.
smitbarmase
added a commit
to zed-industries/zed
that referenced
this pull request
Feb 10, 2026
Follow-up to #47420 and #44193. #47420 fixed child-exit status handling via upstream alacritty change (alacritty/alacritty#8825). However, stable/preview/nightly builds still reproduced hangs that dev builds did not. The root cause matches #44193: spawned children inherit crash-handler Mach exception ports and hang. We already reset exception ports in `util::command::new_smol_command` and `util::set_pre_exec_to_start_new_session`, but PTY child spawning in `alacritty_terminal` was not covered. This PR updates `alacritty_terminal` to include PTY `pre_exec` exception-port reset: zed-industries/alacritty@9d9640d Upstream: - alacritty/alacritty#8835 Release Notes: - Fixed terminal tasks hanging on macOS when a spawned process is killed by a signal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change passes
ExitStatusdirectly inChildEvent::ExitedandEvent::ChildExitinstead ofi32.Previously,
ExitStatus::code()was used which returnsNonefor signal terminations, so downstream couldn't detect when a process was killed by a signal. Now downstream receives the fullExitStatusand can use.code(),.signal(), etc. as needed.Downstream PR: zed-industries/zed#47420