fish-shell/tests/checks/signal.fish
Johannes Altmanninger 8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00

75 lines
1.7 KiB
Fish

# RUN: env fish_test_helper=%fish_test_helper %fish -C 'set -l fish %fish' %s | %filter-ctrlseqs
$fish -c 'function main; exit 4; true; end; main'
echo $status
#CHECK: 4
$fish -c 'begin; exit 5; true; end'
echo $status
#CHECK: 5
$fish -c 'kill -SIGHUP $fish_pid'
echo $status
#CHECK: 129
$fish -c 'function main; kill -SIGTERM $fish_pid; true; end; main'
echo $status
#CHECK: 143
function alarm --on-signal ALRM
echo ALRM received
end
kill -s ALRM $fish_pid
# CHECK: ALRM received
function anychild --on-process-exit 0
# Type and exit status
echo $argv[1] $argv[3]
end
function anyjob --on-job-exit 0
# Type and exit status
echo $argv[1] $argv[3]
end
echo "command false:"
command false
# CHECK: command false:
# (Solaris' false exits with 255, not 1)
# CHECK: PROCESS_EXIT {{1|255}}
# CHECK: JOB_EXIT 0
echo "command true:"
command true
# CHECK: command true:
# CHECK: PROCESS_EXIT 0
# CHECK: JOB_EXIT 0
echo "command false | true:"
command false | command true
# CHECK: command false | true:
# CHECK: PROCESS_EXIT {{1|255}}
# CHECK: PROCESS_EXIT 0
# CHECK: JOB_EXIT 0
# Signals are reported correctly.
# SIGKILL $status is 128 + 9 = 137
$fish_test_helper sigkill_self
# CHECK: PROCESS_EXIT 137
# CHECK: JOB_EXIT 0
function test_blocks
block -l
command echo "This is the process whose exit event should be blocked"
echo "This should come before the event handler"
end
test_blocks
# CHECK: This is the process whose exit event should be blocked
# CHECK: This should come before the event handler
echo "Now event handler should have run"
# CHECK: PROCESS_EXIT 0
# CHECK: JOB_EXIT 0
# CHECK: Now event handler should have run
# CHECK: PROCESS_EXIT 0