-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not exit shell on Ctrl+C with SIGINT ignored (re: 7e5fd3e)
The killpg(getpgrp(),SIGINT) call added to ed_getchar() in that commit caused the interactive shell to exit on ^C even if SIGINT is being ignored. We cannot revert or remove that call without breaking job control. This commit applies a new fix instead. Reproducers fixed by this commit: SIGINT ignored by child: $ PS1='childshell$ ' ksh childshell$ trap '' INT childshell$ (press Ctrl+C) $ SIGINT ignored by parent: $ (trap '' INT; ENV=/./dev/null PS1='childshell$ ' ksh) childshell$ (press Ctrl+C) $ SIGINT ignored by parent, trapped in child: $ (trap '' INT; ENV=/./dev/null PS1='childshell$ ' ksh) childshell$ trap 'echo test' INT childshell$ (press Ctrl+C) $ I've experimentally determined that, under these conditions, the SFIO stream error state is set to 256 == 0400 == SH_EXITSIG. src/cmd/ksh93/sh/main.c: exfile(): - On EOF or error, do not return (exiting the shell) if the shell state is interactive and if sferror(iop)==SH_EXITSIG. - Refactor that block a little to make the new check fit in nicely. src/cmd/ksh93/tests/pty.sh: - Test the above three reproducers. Fixes: #343
- Loading branch information
Showing
3 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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