Skip to content

Commit c776414

Browse files
committed
functions/trap: Don't test with one argument
That's a POSIX misfeature. Also there was one actually wrong `test sig` that should have been `test $sig`.
1 parent dc885d7 commit c776414

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

share/functions/trap.fish

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function trap -d 'Perform an action when the shell receives a signal'
5454
case clear
5555
for i in $argv
5656
set sig (__trap_translate_signal $i)
57-
if test $sig
57+
if test -n "$sig"
5858
functions -e __trap_handler_$sig
5959
end
6060
end
@@ -67,7 +67,7 @@ function trap -d 'Perform an action when the shell receives a signal'
6767
set -l sig (__trap_translate_signal $i)
6868
set sw (__trap_switch $sig)
6969

70-
if test $sig
70+
if test -n "$sig"
7171
echo "function __trap_handler_$sig $sw; $cmd; end" | source
7272
else
7373
return 1
@@ -85,7 +85,7 @@ function trap -d 'Perform an action when the shell receives a signal'
8585
for i in $names
8686
set sig (__trap_translate_signal $i)
8787

88-
if test sig
88+
if test -n "$sig"
8989
functions __trap_handler_$i
9090
else
9191
return 1

0 commit comments

Comments
 (0)