Use the builtin $signals array
This commit is contained in:
parent
2baa4dce0c
commit
a1a2a37045
|
@ -6,14 +6,6 @@
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# 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.
|
# Adds a function name to a list to be called when a trap is triggered.
|
||||||
function add-zsh-trap {
|
function add-zsh-trap {
|
||||||
if (( $# < 2 )); then
|
if (( $# < 2 )); then
|
||||||
|
@ -21,7 +13,7 @@ function add-zsh-trap {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$_trap_signals[(r)$1]" ]]; then
|
if [[ -z "$signals[(r)$1]" ]]; then
|
||||||
print "$0: unknown signal: $1" >&2
|
print "$0: unknown signal: $1" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue