Use the builtin $signals array
This commit is contained in:
parent
2baa4dce0c
commit
a1a2a37045
@ -6,14 +6,6 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# Trap signals were generated with 'kill -l'.
|
||||
# DEBUG, EXIT, and ZERR are Zsh signals.
|
||||
_trap_signals=(
|
||||
ABRT ALRM BUS CHLD CONT EMT FPE HUP ILL INFO INT IO KILL PIPE PROF QUIT
|
||||
SEGV STOP SYS TERM TRAP TSTP TTIN TTOU URG USR1 USR2 VTALRM WINCH XCPU XFSZ
|
||||
DEBUG EXIT ZERR
|
||||
)
|
||||
|
||||
# Adds a function name to a list to be called when a trap is triggered.
|
||||
function add-zsh-trap {
|
||||
if (( $# < 2 )); then
|
||||
@ -21,7 +13,7 @@ function add-zsh-trap {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -z "$_trap_signals[(r)$1]" ]]; then
|
||||
if [[ -z "$signals[(r)$1]" ]]; then
|
||||
print "$0: unknown signal: $1" >&2
|
||||
return 1
|
||||
fi
|
||||
|
Reference in New Issue
Block a user