Results for builtin-trap.test.sh

statusbashdashashzshmkshkshtoyshsushbrushosh
pass 282223142022313926
ok 0440500002
N-I 0310100000
BUG-2 0010000000
BUG 2110400000
FAIL 00016082717212
total30303030303030303030
casebashdashashzshmkshkshtoyshsushbrushoshdescription
0BUG pass BUG-2 FAIL pass pass FAIL FAIL FAIL pass traps are not active inside subshells $() () trap | cat
detailsdetailsdetailsdetailsdetailsdetails
1pass pass pass pass pass pass FAIL FAIL FAIL pass trap accepts/ignores --
detailsdetailsdetails
2pass pass pass pass pass pass pass pass pass pass Register invalid trap, remove invalid trap
3pass pass pass FAIL BUG FAIL pass pass pass pass trap foo gives non-zero error
detailsdetailsdetails
4pass N-I pass FAIL pass pass FAIL pass pass pass SIGINT and INT are aliases
detailsdetailsdetails
5pass pass pass pass pass pass FAIL pass FAIL pass trap without args prints traps
detailsdetails
6pass ok ok FAIL ok FAIL FAIL pass pass FAIL print trap handler with multiple lines
detailsdetailsdetailsdetailsdetailsdetailsdetails
7pass N-I N-I FAIL N-I FAIL FAIL FAIL FAIL pass trap -p is like trap: it prints the handlers and full signal names
detailsdetailsdetailsdetailsdetailsdetailsdetailsdetails
8pass ok ok FAIL ok FAIL FAIL FAIL FAIL pass Register the same handler for multiple signals
detailsdetailsdetailsdetailsdetailsdetailsdetailsdetails
9pass pass pass FAIL pass pass pass FAIL FAIL pass Remove multiple handlers with trap -
detailsdetailsdetails
10pass ok ok FAIL BUG FAIL FAIL FAIL pass pass trap EXIT clears the EXIT trap
detailsdetailsdetailsdetailsdetailsdetailsdetails
11pass ok ok FAIL ok FAIL FAIL FAIL FAIL pass trap 0 is equivalent to trap EXIT
detailsdetailsdetailsdetailsdetailsdetailsdetailsdetails
12pass N-I pass FAIL pass pass FAIL pass pass pass trap 1 is equivalent to SIGHUP; HUP is equivalent to SIGHUP
detailsdetailsdetails
13pass pass pass pass pass pass FAIL FAIL FAIL pass trap 0 2 resets EXIT AND SIGINT
detailsdetailsdetails
14pass pass pass FAIL BUG pass FAIL FAIL pass FAIL trap '' EXIT - printing state
detailsdetailsdetailsdetailsdetails
15pass pass pass FAIL pass pass FAIL FAIL pass ok trap 'echo hi' KILL (regression test, caught by smoosh suite)
detailsdetailsdetailsdetails
16BUG BUG BUG pass BUG FAIL FAIL FAIL FAIL pass exit 1 when trap code string is invalid
detailsdetailsdetailsdetailsdetailsdetailsdetailsdetails
17pass pass pass FAIL pass pass FAIL pass FAIL pass trap EXIT calling exit
detailsdetailsdetails
18pass pass pass pass pass pass FAIL FAIL FAIL pass trap EXIT return status ignored
detailsdetailsdetails
19pass pass pass FAIL ok FAIL FAIL FAIL FAIL pass trap EXIT with PARSE error
detailsdetailsdetailsdetailsdetailsdetails
20pass pass pass FAIL pass pass FAIL pass FAIL pass trap EXIT with PARSE error and explicit exit
detailsdetailsdetails
21pass pass pass pass pass pass FAIL FAIL FAIL pass trap EXIT with explicit exit
detailsdetailsdetails
22pass pass pass pass pass pass FAIL pass FAIL pass trap EXIT with command sub / subshell / pipeline
detailsdetails
23pass pass pass pass pass pass FAIL pass FAIL pass eval in the exit trap (regression for issue #293)
detailsdetails
24pass pass pass pass pass pass FAIL FAIL FAIL pass exit codes for traps are isolated
detailsdetailsdetails
25pass pass pass pass pass pass FAIL FAIL FAIL pass traps are cleared in subshell (started with &)
detailsdetailsdetails
26pass pass pass pass pass pass FAIL pass FAIL pass trap USR1, sleep, SIGINT: non-interactively
detailsdetails
27pass pass pass pass ok pass FAIL pass pass ok trap INT, sleep, SIGINT: non-interactively
detailsdetailsdetails
28pass pass pass pass pass pass FAIL pass FAIL pass trap EXIT, sleep, SIGINT: non-interactively
detailsdetails
29pass pass pass FAIL pass pass FAIL FAIL FAIL pass Remove trap with an unsigned integer
detailsdetailsdetailsdetails
180 passed, 15 OK, 5 not implemented, 9 BUG, 91 failed, 0 timeouts, 0 cases skipped
2 failed under osh

Details on runs that didn't PASS

bash0 traps are not active inside subshells $() () trap | cat

stdout:
1 traps.txt
( )
trap -- 'echo bye' EXIT
$(trap)
trap -- 'echo bye' EXIT
trap | cat
trap -- 'echo bye' EXIT
bye
stderr:
ash0 traps are not active inside subshells $() () trap | cat

stdout:
1 traps.txt
( )
$(trap)
trap -- 'echo bye' EXIT
trap | cat
bye
stderr:
zsh0 traps are not active inside subshells $() () trap | cat

[zsh stdout] Expected '1 traps.txt\n( )\n$(trap)\n\ntrap | cat\nbye\n' Got "1 traps.txt\n( )\n$(trap)\n\ntrap | cat\ntrap -- 'echo bye' EXIT\nbye\n"

stdout:
1 traps.txt
( )
$(trap)

trap | cat
trap -- 'echo bye' EXIT
bye
stderr:
toysh0 traps are not active inside subshells $() () trap | cat

[toysh stdout] Expected '1 traps.txt\n( )\n$(trap)\n\ntrap | cat\nbye\n' Got '0 traps.txt\n( )\n$(trap)\n\ntrap | cat\n'

stdout:
0 traps.txt
( )
$(trap)

trap | cat
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sush0 traps are not active inside subshells $() () trap | cat

[sush stdout] Expected '1 traps.txt\n( )\n$(trap)\n\ntrap | cat\nbye\n' Got "1 traps.txt\n( )\ntrap -- 'echo bye' EXIT\n$(trap)\ntrap -- 'echo bye' EXIT\ntrap | cat\ntrap -- 'echo bye' EXIT\nbye\n"

stdout:
1 traps.txt
( )
trap -- 'echo bye' EXIT
$(trap)
trap -- 'echo bye' EXIT
trap | cat
trap -- 'echo bye' EXIT
bye
stderr:
brush0 traps are not active inside subshells $() () trap | cat

[brush stdout] Expected '1 traps.txt\n( )\n$(trap)\n\ntrap | cat\nbye\n' Got "1 traps.txt\n( )\ntrap -- 'echo bye' EXIT\n$(trap)\ntrap -- 'echo bye' EXIT\ntrap | cat\ntrap -- 'echo bye' EXIT\n"

stdout:
1 traps.txt
( )
trap -- 'echo bye' EXIT
$(trap)
trap -- 'echo bye' EXIT
trap | cat
trap -- 'echo bye' EXIT
stderr:
toysh1 trap accepts/ignores --

[toysh stdout] Expected 'ok\nhi\n' Got 'ok\n'

stdout:
ok
stderr:
sh: trap: No such file or directory
sush1 trap accepts/ignores --

[sush stdout] Expected 'ok\nhi\n' Got 'ok\n'

stdout:
ok
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: trap: echo hi: invalid signal specification
brush1 trap accepts/ignores --

[brush stdout] Expected 'ok\nhi\n' Got 'ok\n'

stdout:
ok
stderr:
zsh3 trap foo gives non-zero error

[zsh stdout] Expected 'ok\n' Got ''

stdout:
stderr: 
mksh3 trap foo gives non-zero error

stdout:
stderr: 
ksh3 trap foo gives non-zero error

[ksh stdout] Expected 'ok\n' Got ''

stdout:
stderr: 
dash4 SIGINT and INT are aliases

stdout:
1
0
stderr:
trap: SIGINT: bad trap
zsh4 SIGINT and INT are aliases

[zsh stdout] Expected '0\n0\n' Got '1\n1\n'

stdout:
1
1
stderr:
trap: undefined signal: SIGINT
trap: undefined signal: INT
toysh4 SIGINT and INT are aliases

[toysh stdout] Expected '0\n0\n' Got '127\n127\n'

stdout:
127
127
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
toysh5 trap without args prints traps

[toysh stdout] Expected "status=0\ntrap -- 'echo exit' EXIT\nstatus=0\nexit\n" Got 'status=127\nstatus=127\n'

stdout:
status=127
status=127
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
brush5 trap without args prints traps

[brush stdout] Expected "status=0\ntrap -- 'echo exit' EXIT\nstatus=0\nexit\n" Got "status=0\ntrap -- 'echo exit' EXIT\nstatus=0\n"

stdout:
status=0
trap -- 'echo exit' EXIT
status=0
stderr:
dash6 print trap handler with multiple lines

stdout:
trap -- 'echo 1
echo 2
echo 3' INT
stderr:
ash6 print trap handler with multiple lines

stdout:
trap -- 'echo 1
echo 2
echo 3' INT
stderr:
zsh6 print trap handler with multiple lines

[zsh stdout] Expected "trap -- 'echo 1\necho 2\necho 3' SIGINT\n" Got ''

stdout:
stderr: 
trap: undefined signal: INT
mksh6 print trap handler with multiple lines

stdout:
trap -- $'echo 1\necho 2\necho 3' INT
stderr:
ksh6 print trap handler with multiple lines

[ksh stdout] Expected "trap -- 'echo 1\necho 2\necho 3' SIGINT\n" Got "trap -- $'echo 1\\necho 2\\necho 3' INT\n"

stdout:
trap -- $'echo 1\necho 2\necho 3' INT
stderr:
toysh6 print trap handler with multiple lines

[toysh stdout] Expected "trap -- 'echo 1\necho 2\necho 3' SIGINT\n" Got ''
[toysh status] Expected 0 Got 127

stdout:
stderr: 
sh: trap: No such file or directory
sh: trap: No such file or directory
osh6 print trap handler with multiple lines

[osh stdout] Expected "trap -- 'echo 1\necho 2\necho 3' SIGINT\n" Got "trap -- '<unknown>' SIGINT\n"

stdout:
trap -- '<unknown>' SIGINT
stderr:
dash7 trap -p is like trap: it prints the handlers and full signal names

stdout:
stderr: 
ash7 trap -p is like trap: it prints the handlers and full signal names

stdout:
EXIT
stderr:
ash: trap: line 4: illegal option -p
zsh7 trap -p is like trap: it prints the handlers and full signal names

[zsh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\nEXIT\n" Got 'EXIT\n'

stdout:
EXIT
stderr:
trap: undefined signal: INT
mksh7 trap -p is like trap: it prints the handlers and full signal names

stdout:
EXIT
stderr:
mksh: <stdin>[4]: trap: -p: unknown option
ksh7 trap -p is like trap: it prints the handlers and full signal names

[ksh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\nEXIT\n" Got 'EXIT\n'
[ksh status] Expected 0 Got 1

stdout:
EXIT
stderr:
E: ksh: <stdin>[4]: trap: -p: unknown option
toysh7 trap -p is like trap: it prints the handlers and full signal names

[toysh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\nEXIT\n" Got ''
[toysh status] Expected 0 Got -6

stdout:
stderr: 
munmap_chunk(): invalid pointer
sush7 trap -p is like trap: it prints the handlers and full signal names

[sush stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\nEXIT\n" Got 'EXIT\n'

stdout:
EXIT
stderr:
trap: usage: trap arg signal_spec ...
brush7 trap -p is like trap: it prints the handlers and full signal names

[brush stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\nEXIT\n" Got "trap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\n"

stdout:
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
stderr:
dash8 Register the same handler for multiple signals

stdout:
trap -- 'echo test' EXIT
trap -- 'echo test' INT
trap -- 'echo test' TERM
test
stderr:
ash8 Register the same handler for multiple signals

stdout:
trap -- 'echo test' EXIT
trap -- 'echo test' INT
trap -- 'echo test' TERM
test
stderr:
zsh8 Register the same handler for multiple signals

[zsh stdout] Expected "trap -- 'echo test' EXIT\ntrap -- 'echo test' SIGINT\ntrap -- 'echo test' SIGTERM\ntest\n" Got ''

stdout:
stderr: 
trap: undefined signal: TERM
mksh8 Register the same handler for multiple signals

stdout:
trap -- 'echo test' EXIT
trap -- 'echo test' INT
trap -- 'echo test' TERM
test
stderr:
ksh8 Register the same handler for multiple signals

[ksh stdout] Expected "trap -- 'echo test' EXIT\ntrap -- 'echo test' SIGINT\ntrap -- 'echo test' SIGTERM\ntest\n" Got "trap -- 'echo test' EXIT\ntrap -- 'echo test' INT\ntrap -- 'echo test' TERM\ntest\n"

stdout:
trap -- 'echo test' EXIT
trap -- 'echo test' INT
trap -- 'echo test' TERM
test
stderr:
toysh8 Register the same handler for multiple signals

[toysh stdout] Expected "trap -- 'echo test' EXIT\ntrap -- 'echo test' SIGINT\ntrap -- 'echo test' SIGTERM\ntest\n" Got ''
[toysh status] Expected 0 Got 127

stdout:
stderr: 
sh: trap: No such file or directory
sh: trap: No such file or directory
sush8 Register the same handler for multiple signals

[sush stdout] Expected "trap -- 'echo test' EXIT\ntrap -- 'echo test' SIGINT\ntrap -- 'echo test' SIGTERM\ntest\n" Got "trap -- 'echo test' SIGTERM\ntrap -- 'echo test' SIGINT\ntrap -- 'echo test' EXIT\ntest\n"

stdout:
trap -- 'echo test' SIGTERM
trap -- 'echo test' SIGINT
trap -- 'echo test' EXIT
test
stderr:
brush8 Register the same handler for multiple signals

[brush stdout] Expected "trap -- 'echo test' EXIT\ntrap -- 'echo test' SIGINT\ntrap -- 'echo test' SIGTERM\ntest\n" Got "trap -- 'echo test' SIGINT\ntrap -- 'echo test' SIGTERM\ntrap -- 'echo test' EXIT\n"

stdout:
trap -- 'echo test' SIGINT
trap -- 'echo test' SIGTERM
trap -- 'echo test' EXIT
stderr:
zsh9 Remove multiple handlers with trap -

[zsh stdout] Expected '---\nok\n' Got "trap -- 'echo e' EXIT\n---\nok\ne\n"

stdout:
trap -- 'echo e' EXIT
---
ok
e
stderr:
trap: undefined signal: INT
trap: undefined signal: int
trap: undefined signal: INT
trap: undefined signal: int
sush9 Remove multiple handlers with trap -

[sush stdout] Expected '---\nok\n' Got "trap -- 'echo int' SIGINT\ntrap -- 'echo e' EXIT\n---\nok\ne\n"

stdout:
trap -- 'echo int' SIGINT
trap -- 'echo e' EXIT
---
ok
e
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 3: trap: int: invalid signal specification
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 9: trap: int: invalid signal specification
brush9 Remove multiple handlers with trap -

[brush stdout] Expected '---\nok\n' Got "trap -- 'echo e' EXIT\n---\nok\n"

stdout:
trap -- 'echo e' EXIT
---
ok
stderr:
error: unexpected argument '-9' found

  tip: to pass '-9' as a value, use '-- -9'

Usage: trap [OPTIONS] [ARGS]...

For more information, try '--help'.

dash10 trap EXIT clears the EXIT trap

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo INT' INT
---
stderr:
ash10 trap EXIT clears the EXIT trap

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo INT' INT
---
stderr:
zsh10 trap EXIT clears the EXIT trap

[zsh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n---\n" Got "trap -- 'echo EXIT' EXIT\n---\n---\n"

stdout:
trap -- 'echo EXIT' EXIT
---
---
stderr:
trap: undefined signal: INT
mksh10 trap EXIT clears the EXIT trap

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
EXIT
stderr:
ksh10 trap EXIT clears the EXIT trap

[ksh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n---\n" Got "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' INT\n---\ntrap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' INT\n---\ntrap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' INT\nEXIT\n"

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
EXIT
stderr:
toysh10 trap EXIT clears the EXIT trap

[toysh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n---\n" Got '---\n---\n'
[toysh status] Expected 0 Got 127

stdout:
---
---
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sush10 trap EXIT clears the EXIT trap

[sush stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n---\n" Got "trap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\n---\ntrap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\n---\ntrap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\nEXIT\n"

stdout:
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
---
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
---
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
EXIT
stderr:
trap: usage: trap arg signal_spec ...
trap: usage: trap arg signal_spec ...
dash11 trap 0 is equivalent to trap EXIT

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo INT' INT
stderr:
ash11 trap 0 is equivalent to trap EXIT

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo INT' INT
stderr:
zsh11 trap 0 is equivalent to trap EXIT

[zsh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n" Got "trap -- 'echo EXIT' EXIT\n---\n"

stdout:
trap -- 'echo EXIT' EXIT
---
stderr:
trap: undefined signal: INT
mksh11 trap 0 is equivalent to trap EXIT

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo INT' INT
stderr:
ksh11 trap 0 is equivalent to trap EXIT

[ksh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n" Got "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' INT\n---\ntrap -- 'echo INT' INT\n"

stdout:
trap -- 'echo EXIT' EXIT
trap -- 'echo INT' INT
---
trap -- 'echo INT' INT
stderr:
toysh11 trap 0 is equivalent to trap EXIT

[toysh stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n" Got '---\n'
[toysh status] Expected 0 Got 127

stdout:
---
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sush11 trap 0 is equivalent to trap EXIT

[sush stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n" Got "trap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\n---\ntrap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\nEXIT\n"

stdout:
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
---
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
EXIT
stderr:
trap: usage: trap arg signal_spec ...
brush11 trap 0 is equivalent to trap EXIT

[brush stdout] Expected "trap -- 'echo EXIT' EXIT\ntrap -- 'echo INT' SIGINT\n---\ntrap -- 'echo INT' SIGINT\n" Got "trap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\n---\ntrap -- 'echo INT' SIGINT\n"

stdout:
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
---
trap -- 'echo INT' SIGINT
stderr:
dash12 trap 1 is equivalent to SIGHUP; HUP is equivalent to SIGHUP

stdout:
status=1
status=0
status=0
status=0
stderr:
trap: SIGHUP: bad trap
zsh12 trap 1 is equivalent to SIGHUP; HUP is equivalent to SIGHUP

[zsh stdout] Expected 'status=0\nstatus=0\nstatus=0\nstatus=0\n' Got 'status=1\nstatus=1\nstatus=0\nstatus=1\n'

stdout:
status=1
status=1
status=0
status=1
stderr:
trap: undefined signal: SIGHUP
trap: undefined signal: HUP
trap: undefined signal: HUP
toysh12 trap 1 is equivalent to SIGHUP; HUP is equivalent to SIGHUP

[toysh stdout] Expected 'status=0\nstatus=0\nstatus=0\nstatus=0\n' Got 'status=127\nstatus=127\nstatus=127\nstatus=127\n'

stdout:
status=127
status=127
status=127
status=127
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
toysh13 trap 0 2 resets EXIT AND SIGINT

[toysh stdout] Expected "---\ntrap -- 'echo EXIT' EXIT\n---\n---\n" Got '---\n---\n---\n'
[toysh status] Expected 0 Got 127

stdout:
---
---
---
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sush13 trap 0 2 resets EXIT AND SIGINT

[sush stdout] Expected "---\ntrap -- 'echo EXIT' EXIT\n---\n---\n" Got "---\ntrap -- 'echo EXIT' EXIT\n---\ntrap -- 'echo EXIT' EXIT\ntrap -- '0' SIGINT\n---\ntrap -- 'echo EXIT' EXIT\ntrap -- '0' SIGINT\ntrap -- 'echo INT' SIGINT\ntrap -- 'echo EXIT' EXIT\ntrap -- '2' EXIT\n"
[sush status] Expected 0 Got 127

stdout:
---
trap -- 'echo EXIT' EXIT
---
trap -- 'echo EXIT' EXIT
trap -- '0' SIGINT
---
trap -- 'echo EXIT' EXIT
trap -- '0' SIGINT
trap -- 'echo INT' SIGINT
trap -- 'echo EXIT' EXIT
trap -- '2' EXIT
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: 2: command not found
brush13 trap 0 2 resets EXIT AND SIGINT

[brush stdout] Expected "---\ntrap -- 'echo EXIT' EXIT\n---\n---\n" Got "---\ntrap -- 'echo EXIT' EXIT\n---\ntrap -- 'echo EXIT' EXIT\ntrap -- '0' SIGINT\n---\ntrap -- '2' EXIT\ntrap -- 'echo INT' SIGINT\n"

stdout:
---
trap -- 'echo EXIT' EXIT
---
trap -- 'echo EXIT' EXIT
trap -- '0' SIGINT
---
trap -- '2' EXIT
trap -- 'echo INT' SIGINT
stderr:
zsh14 trap '' EXIT - printing state

[zsh stdout] Expected "trap -- 'echo exit' EXIT\n\ntrap -- '' EXIT\n\ntrap -- '# comment' EXIT\n" Got "trap -- 'echo exit' EXIT\n\ntrap -- '' EXIT\n\ntrap -- '' EXIT\n"

stdout:
trap -- 'echo exit' EXIT

trap -- '' EXIT

trap -- '' EXIT
stderr:
mksh14 trap '' EXIT - printing state

stdout:
trap -- 'echo exit' EXIT

trap --  EXIT

trap -- '# comment' EXIT
stderr:
toysh14 trap '' EXIT - printing state

[toysh stdout] Expected "trap -- 'echo exit' EXIT\n\ntrap -- '' EXIT\n\ntrap -- '# comment' EXIT\n" Got '\n\n'
[toysh status] Expected 0 Got 127

stdout:

stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sush14 trap '' EXIT - printing state

[sush stdout] Expected "trap -- 'echo exit' EXIT\n\ntrap -- '' EXIT\n\ntrap -- '# comment' EXIT\n" Got "trap -- 'echo exit' EXIT\n\ntrap -- 'echo exit' EXIT\ntrap -- '' EXIT\n\ntrap -- 'echo exit' EXIT\ntrap -- '' EXIT\ntrap -- '# comment' EXIT\n"

stdout:
trap -- 'echo exit' EXIT

trap -- 'echo exit' EXIT
trap -- '' EXIT

trap -- 'echo exit' EXIT
trap -- '' EXIT
trap -- '# comment' EXIT
stderr:
osh14 trap '' EXIT - printing state

[osh stdout] Expected "trap -- 'echo exit' EXIT\n\ntrap -- '' EXIT\n\ntrap -- '# comment' EXIT\n" Got "trap -- 'echo exit' EXIT\n\ntrap -- '<unknown>' EXIT\n\ntrap -- '<unknown>' EXIT\n"

stdout:
trap -- 'echo exit' EXIT

trap -- '<unknown>' EXIT

trap -- '<unknown>' EXIT
stderr:
zsh15 trap 'echo hi' KILL (regression test, caught by smoosh suite)

[zsh stdout] Expected 'status=0\nstatus=0\nstatus=0\nstatus=0\n' Got 'status=0\nstatus=1\nstatus=0\nstatus=1\n'

stdout:
status=0
status=1
status=0
status=1
stderr:
trap: undefined signal: KILL
trap: undefined signal: TERM
toysh15 trap 'echo hi' KILL (regression test, caught by smoosh suite)

[toysh stdout] Expected 'status=0\nstatus=0\nstatus=0\nstatus=0\n' Got 'status=127\nstatus=127\nstatus=127\nstatus=127\n'

stdout:
status=127
status=127
status=127
status=127
stderr:
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sh: trap: No such file or directory
sush15 trap 'echo hi' KILL (regression test, caught by smoosh suite)

[sush stdout] Expected 'status=0\nstatus=0\nstatus=0\nstatus=0\n' Got 'status=1\n'
[sush status] Expected 0 Got -6

stdout:
status=1
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: trap: 9: forbidden signal for trap

thread 'main' panicked at src/signal.rs:16:56:
sush(fatal): cannot ignore signal: EINVAL
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
osh15 trap 'echo hi' KILL (regression test, caught by smoosh suite)

stdout:
status=2
status=2
status=2
status=0
stderr:
  trap 'echo hi' 9
                 ^
[ stdin ]:1: Signal '9' can't be handled
  trap 'echo hi' KILL
                 ^~~~
[ stdin ]:4: Signal 'KILL' can't be handled
  trap 'echo hi' STOP
                 ^~~~
[ stdin ]:7: Signal 'STOP' can't be handled
bash16 exit 1 when trap code string is invalid

stdout:
status=0
stderr:
bash: exit trap: line 1: syntax error near unexpected token `newline'
bash: exit trap: line 1: `echo <'
dash16 exit 1 when trap code string is invalid

stdout:
status=0
stderr:
dash: 1: Syntax error: end of file unexpected
ash16 exit 1 when trap code string is invalid

stdout:
status=0
stderr:
ash: syntax error: unexpected end of file
mksh16 exit 1 when trap code string is invalid

stdout:
status=0
stderr:
mksh: syntax error: unexpected EOF
ksh16 exit 1 when trap code string is invalid

[ksh stdout] Expected 'status=1\n' Got 'status=0\n'
[ksh status] Expected 0 Got 1

stdout:
status=0
stderr:
E: ksh: syntax error: unexpected EOF
toysh16 exit 1 when trap code string is invalid

[toysh stdout] Expected 'status=1\n' Got 'status=127\n'

stdout:
status=127
stderr:
sh: trap: No such file or directory
sush16 exit 1 when trap code string is invalid

[sush stdout] Expected 'status=1\n' Got 'status=0\n'
[sush status] Expected 0 Got 2

stdout:
status=0
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: syntax error near unexpected token: <
brush16 exit 1 when trap code string is invalid

[brush stdout] Expected 'status=1\n' Got 'status=0\n'

stdout:
status=0
stderr:
zsh17 trap EXIT calling exit

[zsh status] Expected 42 Got 0

stdout:
cleanup [x y z]
stderr:
toysh17 trap EXIT calling exit

[toysh stdout] Expected 'cleanup [x y z]\n' Got ''
[toysh status] Expected 42 Got 127

stdout:
stderr: 
sh: trap: No such file or directory
brush17 trap EXIT calling exit

[brush stdout] Expected 'cleanup [x y z]\n' Got ''
[brush status] Expected 42 Got 0

stdout:
stderr: 
toysh18 trap EXIT return status ignored

[toysh stdout] Expected 'cleanup [x y z]\n' Got ''
[toysh status] Expected 0 Got 127

stdout:
stderr: 
sh: trap: No such file or directory
sush18 trap EXIT return status ignored

[sush status] Expected 0 Got 42

stdout:
cleanup [x y z]
stderr:
brush18 trap EXIT return status ignored

[brush stdout] Expected 'cleanup [x y z]\n' Got ''

stdout:
stderr: 
zsh19 trap EXIT with PARSE error

[zsh status] Expected 2 Got 1

stdout:
FAILED
stderr:
zsh: parse error near `\n'
mksh19 trap EXIT with PARSE error

stdout:
FAILED
stderr:
mksh: <stdin>[2]: syntax error: 'newline' unexpected
ksh19 trap EXIT with PARSE error

[ksh status] Expected 2 Got 1

stdout:
FAILED
stderr:
E: ksh: <stdin>[2]: syntax error: unexpected 'newline'
toysh19 trap EXIT with PARSE error

[toysh stdout] Expected 'FAILED\n' Got ''

stdout:
stderr: 
sh: trap: No such file or directory
main: line 2: sh: syntax error: newline
sush19 trap EXIT with PARSE error

[sush status] Expected 2 Got 0

stdout:
FAILED
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 3: syntax error near unexpected token: 

brush19 trap EXIT with PARSE error

[brush stdout] Expected 'FAILED\n' Got ''

stdout:
stderr: 
error: main: syntax error near token `
' (line 1 col 4)
zsh20 trap EXIT with PARSE error and explicit exit

[zsh status] Expected 0 Got 1

stdout:
FAILED
stderr:
zsh: parse error near `\n'
toysh20 trap EXIT with PARSE error and explicit exit

[toysh stdout] Expected 'FAILED\n' Got ''
[toysh status] Expected 0 Got 2

stdout:
stderr: 
sh: trap: No such file or directory
main: line 2: sh: syntax error: newline
brush20 trap EXIT with PARSE error and explicit exit

[brush stdout] Expected 'FAILED\n' Got ''
[brush status] Expected 0 Got 2

stdout:
stderr: 
error: main: syntax error near token `
' (line 1 col 4)
toysh21 trap EXIT with explicit exit

[toysh stdout] Expected 'IN TRAP\nFOO\n' Got ''

stdout:
stderr: 
sh: trap: No such file or directory
sush21 trap EXIT with explicit exit

[sush status] Expected 42 Got 0

stdout:
IN TRAP
FOO
stderr:
brush21 trap EXIT with explicit exit

[brush stdout] Expected 'IN TRAP\nFOO\n' Got ''

stdout:
stderr: 
toysh22 trap EXIT with command sub / subshell / pipeline

[toysh stdout] Expected 'command sub\nsubshell\npipeline\nEXIT TRAP\n' Got 'command sub\nsubshell\npipeline\n'

stdout:
command sub
subshell
pipeline
stderr:
sh: trap: No such file or directory
brush22 trap EXIT with command sub / subshell / pipeline

[brush stdout] Expected 'command sub\nsubshell\npipeline\nEXIT TRAP\n' Got 'command sub\nsubshell\npipeline\n'

stdout:
command sub
subshell
pipeline
stderr:
toysh23 eval in the exit trap (regression for issue #293)

[toysh stdout] Expected 'hi\n' Got ''
[toysh status] Expected 0 Got 127

stdout:
stderr: 
sh: trap: No such file or directory
brush23 eval in the exit trap (regression for issue #293)

[brush stdout] Expected 'hi\n' Got ''

stdout:
stderr: 
toysh24 exit codes for traps are isolated

[toysh stdout] Expected 'before=0\nUSR1 trap status=0\nafter=0\n' Got 'before=127\n'
[toysh status] Expected 0 Got -10

stdout:
before=127
stderr:
sh: trap: No such file or directory
sush24 exit codes for traps are isolated

[sush stdout] Expected 'before=0\nUSR1 trap status=0\nafter=0\n' Got 'before=0\nafter=0\n'

stdout:
before=0
after=0
stderr:
brush24 exit codes for traps are isolated

[brush stdout] Expected 'before=0\nUSR1 trap status=0\nafter=0\n' Got 'before=0\n'
[brush status] Expected 0 Got -10

stdout:
before=0
stderr:
toysh25 traps are cleared in subshell (started with &)

[toysh stdout] Expected 'SIGURG\nbegin child\nend child\nwait status 0\n' Got 'begin child\nend child\nwait status 0\n'

stdout:
begin child
end child
wait status 0
stderr:
sh: trap: No such file or directory
kill: missing argument (see "kill --help")
sush25 traps are cleared in subshell (started with &)

[sush stdout] Expected 'SIGURG\nbegin child\nend child\nwait status 0\n' Got 'begin child\nend child\nSIGURG\nwait status 0\n'

stdout:
begin child
end child
SIGURG
wait status 0
stderr:
714750
brush25 traps are cleared in subshell (started with &)

[brush stdout] Expected 'SIGURG\nbegin child\nend child\nwait status 0\n' Got 'begin child\nend child\nwait status 0\n'

stdout:
begin child
end child
wait status 0
stderr:
kill: invalid usage
toysh26 trap USR1, sleep, SIGINT: non-interactively

[toysh stdout] Expected 'usr1\nstatus=0\n' Got 'status=0\n'

stdout:
status=0
stderr:
sh: command: No such file or directory
sh: trap: No such file or directory
sh: -USR1: No such file or directory
brush26 trap USR1, sleep, SIGINT: non-interactively

[brush stdout] Expected 'usr1\nstatus=0\n' Got 'status=0\n'

stdout:
status=0
stderr:
mksh27 trap INT, sleep, SIGINT: non-interactively

stdout:
mksh
stderr:
toysh27 trap INT, sleep, SIGINT: non-interactively

[toysh stdout] Expected 'status=0\n' Got ''
[toysh status] Expected 0 Got -6

stdout:
stderr: 
munmap_chunk(): invalid pointer
osh27 trap INT, sleep, SIGINT: non-interactively

stdout:
int
status=0
stderr:
toysh28 trap EXIT, sleep, SIGINT: non-interactively

[toysh stdout] Expected 'on exit\nstatus=0\n' Got 'status=0\n'

stdout:
status=0
stderr:
sh: command: No such file or directory
sh: trap: No such file or directory
sh: -INT: No such file or directory
brush28 trap EXIT, sleep, SIGINT: non-interactively

[brush stdout] Expected 'on exit\nstatus=0\n' Got 'status=0\n'

stdout:
status=0
stderr:
zsh29 Remove trap with an unsigned integer

[zsh stdout] Expected 'ok0\n\nok42space\n\nok07\n\ntrap-exit\nfailure\n' Got 'ok0\n\nok42space\n\nok07\n\nbad\nfailure\n'

stdout:
ok0

ok42space

ok07

bad
failure
stderr:
zsh:1: command not found: 42
zsh:1: command not found: -1
toysh29 Remove trap with an unsigned integer

[toysh stdout] Expected 'ok0\n\nok42space\n\nok07\n\ntrap-exit\nfailure\n' Got '\n\n\nfailure\n'

stdout:


failure
stderr:
sh: Unknown option 'e' (see "sh --help")
sh: Unknown option 'e' (see "sh --help")
sh: Unknown option 'e' (see "sh --help")
sh: Unknown option 'e' (see "sh --help")
sush29 Remove trap with an unsigned integer

[sush stdout] Expected 'ok0\n\nok42space\n\nok07\n\ntrap-exit\nfailure\n' Got 'ok0\n\nok42space\n\nok07\n\nbad\nfailure\n'

stdout:
ok0

ok42space

ok07

bad
failure
stderr:
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: 0: command not found
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: 42: command not found
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: 07: command not found
/home/andy/git/oils-for-unix/oils/../../shells/rusty_bash/target/release/sush: line 1: -1: command not found
brush29 Remove trap with an unsigned integer

[brush stdout] Expected 'ok0\n\nok42space\n\nok07\n\ntrap-exit\nfailure\n' Got '\n\n\nfailure\n'

stdout:


failure
stderr:
error: unexpected argument '-e' found

  tip: to pass '-e' as a value, use '-- -e'

Usage: brush [OPTIONS]... [SCRIPT_PATH [SCRIPT_ARGS]...]

For more information, try '--help'.
error: unexpected argument '-e' found

  tip: to pass '-e' as a value, use '-- -e'

Usage: brush [OPTIONS]... [SCRIPT_PATH [SCRIPT_ARGS]...]

For more information, try '--help'.
error: unexpected argument '-e' found

  tip: to pass '-e' as a value, use '-- -e'

Usage: brush [OPTIONS]... [SCRIPT_PATH [SCRIPT_ARGS]...]

For more information, try '--help'.
error: unexpected argument '-e' found

  tip: to pass '-e' as a value, use '-- -e'

Usage: brush [OPTIONS]... [SCRIPT_PATH [SCRIPT_ARGS]...]

For more information, try '--help'.