Browse Source

Use the builtin $signals array

master
Sorin Ionescu 12 years ago
parent
commit
a1a2a37045
  1. 10
      modules/helper/functions/add-zsh-trap

10
modules/helper/functions/add-zsh-trap

@ -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…
Cancel
Save