mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 20:50:42 +02:00
minor documentation update on SIGINT handling
This commit is contained in:
+61
-2
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Fri Oct 8 14:10:30 EDT 2021
|
||||
.\" Last Change: Tue Oct 19 11:34:57 EDT 2021
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2021 October 8" "GNU Bash 5.1"
|
||||
.TH BASH 1 "2021 October 19" "GNU Bash 5.1"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -5214,6 +5214,63 @@ When \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP
|
||||
builtin, the reception of a signal for which a trap has been set will
|
||||
cause the \fBwait\fP builtin to return immediately with an exit status
|
||||
greater than 128, immediately after which the trap is executed.
|
||||
.PP
|
||||
When job control is not enabled, and \fBbash\fP is waiting for a foreground
|
||||
command to complete, the shell receives keyboard-generated signals
|
||||
such as
|
||||
.SM
|
||||
.B SIGINT
|
||||
(usually generated by \fB^C\fP) that users commonly intend to send
|
||||
to that command.
|
||||
This happens because the shell and the command are in the
|
||||
same process group as the terminal, and \fB^C\fP sends
|
||||
.SM
|
||||
.B SIGINT
|
||||
to all processes in that process group.
|
||||
.PP
|
||||
When \fBbash\fP is running without job control enabled and receives
|
||||
.SM
|
||||
.B SIGINT
|
||||
while waiting for a foreground command, it waits until that foreground
|
||||
command terminates and then decides what to do about the
|
||||
.SM
|
||||
.BR SIGINT :
|
||||
.IP 1.
|
||||
If the command terminates due to the
|
||||
.SM
|
||||
.BR SIGINT ,
|
||||
\fBbash\fP concludes
|
||||
that the user meant to end the entire script, and acts on the
|
||||
.SM
|
||||
.B SIGINT
|
||||
(e.g., by running a
|
||||
.SM
|
||||
.B SIGINT
|
||||
trap or exiting itself);
|
||||
.IP 2.
|
||||
If the command does not terminate due to
|
||||
.SM
|
||||
.BR SIGINT ,
|
||||
the program handled the
|
||||
.SM
|
||||
.B SIGINT
|
||||
itself and did not treat it as a fatal signal.
|
||||
In that case, \fBbash\fP does not treat
|
||||
.SM
|
||||
.B SIGINT
|
||||
as a fatal signal, either, instead assuming that the
|
||||
.SM
|
||||
.B SIGINT
|
||||
was used as part of the program's normal operation
|
||||
(e.g., emacs uses it to abort editing
|
||||
commands) or deliberately discarded.
|
||||
However, \fBbash\fP will run any
|
||||
trap set on
|
||||
.SM
|
||||
.BR SIGINT ,
|
||||
as it does with any other trapped signal it
|
||||
receives while it is waiting for the foreground command to
|
||||
complete, for compatibility.
|
||||
.SH "JOB CONTROL"
|
||||
.I Job control
|
||||
refers to the ability to selectively stop (\fIsuspend\fP)
|
||||
@@ -10131,6 +10188,8 @@ history is enabled, as described above under
|
||||
.B compat43
|
||||
.TP 8
|
||||
.B compat44
|
||||
.TP 8
|
||||
.B compat50
|
||||
.PD
|
||||
These control aspects of the shell's compatibility mode
|
||||
(see
|
||||
|
||||
Reference in New Issue
Block a user