Change SIGINT special handling#282
Open
jpco wants to merge 2 commits into
Open
Conversation
- Remove sig_special, sigint_newline, and the `.signal' syntax for $signals - Ignore SIGINT entirely if our child did not exit with a SIGINT status - Print \n in %interactive-loop when catching SIG^(INT TSTP QUIT)
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 PR is related to #281. It changes how the
SIGINTsignal is handled by es.If a
SIGINTcomes in while the shell is waiting for aforkexec()ed child, and that child exits withWTERMSIG() != SIGINT, then throw away the signal and do not raise an exception.Remove
sig_special,sigint_newline, and the.sigintsyntax for$signals; defaultsiginthandling tosig_catchwhere previously it would have beensig_special.In the
%interactive-loopexception handler, echo a newline forsigint,sigtstp, andsigquitsignal exceptions.The first change makes es into a "WCE" shell according to https://www.cons.org/cracauer/sigint.html. The idea is that if the shell is waiting for a child process, and that child process is in the same foregrounded process group as the shell (which is generally always true given es has no job control), and if the shell receives a
SIGINT, then the child probably did too, and it should be up to the child whether theSIGINTshould stop everything or not.The second and third changes modify where the special
\nfor^Chappens, from special-cased internal code to a small bit ofiflogic in%interactive-loop(making the newline only happen in interactive shells). This improves the user-visible behavior; for example, with es at head:and with this PR:
For completeness, we also include
sigtstpandsigquitin the special newline handling in%interactive-loop, given they're also terminal-generated signals.This is backwards-incompatible, of course, and it's debatable whether the "WCE" behavior is actually what we want (for example, the
zshfolks intentionally don't go with WCE), but it seems like it nicely kills a few birds with one stone: we remove the special one-off.sigintmechanism AND get better^Cnewline printing AND (arguably) get better handling ofSIGINTwhile waiting for child processes.