mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-30 17:41:14 -03:00
Allow trapping SIGINT and SIGTERM in scripts
This teaches `--on-signal SIGINT` (and by extension `trap cmd SIGINT`) to work properly in scripts, not just interactively. Note any such function will suppress the default behavior of exiting. Do this for SIGTERM as well.
This commit is contained in:
@@ -38,7 +38,7 @@ If *ARG* is absent (and there is a single *REASON*) or ``-``, each specified sig
|
||||
|
||||
If *ARG* is not present and **-p** has been supplied, then the trap commands associated with each *REASON* are displayed. If no arguments are supplied or if only **-p** is given, ``trap`` prints the list of commands associated with each signal.
|
||||
|
||||
Signal names are case insensitive and the ``SIG`` prefix is optional.
|
||||
Signal names are case insensitive and the ``SIG`` prefix is optional. Trapping a signal will prevent fish from exiting in response to that signal.
|
||||
|
||||
The exit status is 1 if any *REASON* is invalid; otherwise trap returns 0.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user