Repository navigation
Report the child's exit status to ghostel-exit-functions on the native PTY - #748
Merged
Merged
Conversation
…e PTY
With the native backend the Emacs process is only the event pipe, so the
sentinel always saw "finished" regardless of how the child exited. Keep
the reaper's exit code on the pipe and rebuild the Emacs-style event
string ("finished" or "exited abnormally with code N") from it, matching
the Emacs PTY backend.
The reaper now terminates the number with a newline so the filter can
tell a complete status from one split across reads.
The hook ran while the redraw timer was still pending, so the buffer did not yet hold the child's last output, and with ghostel-kill-buffer-on-exit the buffer died before it ever would. Commit the terminal grid to the buffer first, rendering directly when ghostel--redraw-now declines for lack of a window. Only done when a hook is registered and copy mode is not holding the display frozen. ghostel-compile had its own copy of this step; it uses the shared helper now.
dakra
force-pushed
the
fix/native-exit-event
branch
from
October 19, 2026 10:27
94e569a to
eb953bc
Compare
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.
With the native PTY backend the Emacs process object is only the event
pipe, so
ghostel--sentinelalways saw "finished" andghostel-exit-functionscould not tell a clean exit from a failure.The Emacs PTY backend already reported the real sentinel string.
The native reaper's exit code is now kept on the pipe before it is
deleted, and the pipe sentinel rebuilds the string Emacs would report
for the child itself: "finished" for 0, "exited abnormally with code N"
otherwise. Hook functions see the same strings on both backends and can
test for "finished" like any process sentinel. A signalled child reports
128 plus the signal number, as the reaper has always done.
The reaper also terminates the number with a newline so the filter can
tell a complete status from one split across two reads.
Tests: the exit-hook event string for
exit 0andexit 3on bothlocal PTY backends, and a filter unit test reassembling a split status.
Fixes the exit-status half of #744. The stderr half (child stderr not
rendering into the VT) is a separate gap and is not addressed here.
Overlaps with #746, which adds a third hook argument instead.