2024-04-12 10:19:32 +00:00
|
|
|
# RUN: env fish_test_helper=%fish_test_helper %fish -C 'set -l fish %fish' %s
|
2019-12-23 12:49:40 +00:00
|
|
|
|
2020-01-13 19:34:22 +00:00
|
|
|
$fish -c 'function main; exit 4; true; end; main'
|
|
|
|
echo $status
|
2019-12-23 12:49:40 +00:00
|
|
|
#CHECK: 4
|
|
|
|
|
2020-01-13 19:34:22 +00:00
|
|
|
$fish -c 'begin; exit 5; true; end'
|
|
|
|
echo $status
|
2019-12-23 12:49:40 +00:00
|
|
|
#CHECK: 5
|
|
|
|
|
2020-05-16 09:20:18 +00:00
|
|
|
$fish -c 'kill -SIGHUP $fish_pid'
|
2020-01-13 19:34:22 +00:00
|
|
|
echo $status
|
2019-12-23 12:49:40 +00:00
|
|
|
#CHECK: 129
|
|
|
|
|
2020-05-16 09:20:18 +00:00
|
|
|
$fish -c 'function main; kill -SIGTERM $fish_pid; true; end; main'
|
2020-01-13 19:34:22 +00:00
|
|
|
echo $status
|
2019-12-23 12:49:40 +00:00
|
|
|
#CHECK: 143
|
2019-06-26 18:07:46 +00:00
|
|
|
|
2019-02-21 01:07:29 +00:00
|
|
|
function alarm --on-signal ALRM
|
2020-01-13 19:34:22 +00:00
|
|
|
echo ALRM received
|
2019-02-21 01:07:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
kill -s ALRM $fish_pid
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: ALRM received
|
2019-02-21 01:07:29 +00:00
|
|
|
|
2019-02-23 20:41:01 +00:00
|
|
|
function anychild --on-process-exit 0
|
2021-05-19 18:29:03 +00:00
|
|
|
# Type and exit status
|
|
|
|
echo $argv[1] $argv[3]
|
|
|
|
end
|
|
|
|
|
|
|
|
function anyjob --on-job-exit 0
|
2020-01-13 19:34:22 +00:00
|
|
|
# Type and exit status
|
|
|
|
echo $argv[1] $argv[3]
|
2019-02-23 20:41:01 +00:00
|
|
|
end
|
|
|
|
|
2019-02-21 05:41:35 +00:00
|
|
|
echo "command false:"
|
2019-02-23 20:41:01 +00:00
|
|
|
command false
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: command false:
|
2021-06-24 16:14:45 +00:00
|
|
|
# (Solaris' false exits with 255, not 1)
|
|
|
|
# CHECK: PROCESS_EXIT {{1|255}}
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: JOB_EXIT 0
|
|
|
|
|
2019-02-21 05:41:35 +00:00
|
|
|
echo "command true:"
|
2019-02-23 20:41:01 +00:00
|
|
|
command true
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: command true:
|
|
|
|
# CHECK: PROCESS_EXIT 0
|
|
|
|
# CHECK: JOB_EXIT 0
|
|
|
|
|
2019-02-21 05:41:35 +00:00
|
|
|
echo "command false | true:"
|
2019-02-23 20:41:01 +00:00
|
|
|
command false | command true
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: command false | true:
|
2021-06-24 16:14:45 +00:00
|
|
|
# CHECK: PROCESS_EXIT {{1|255}}
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: PROCESS_EXIT 0
|
|
|
|
# CHECK: JOB_EXIT 0
|
2019-02-21 05:41:35 +00:00
|
|
|
|
2021-05-17 21:34:52 +00:00
|
|
|
# Signals are reported correctly.
|
|
|
|
# SIGKILL $status is 128 + 9 = 137
|
|
|
|
$fish_test_helper sigkill_self
|
|
|
|
# CHECK: PROCESS_EXIT 137
|
|
|
|
# CHECK: JOB_EXIT 0
|
|
|
|
|
2019-02-21 05:41:35 +00:00
|
|
|
function test_blocks
|
2020-01-13 19:34:22 +00:00
|
|
|
block -l
|
2021-05-17 21:34:52 +00:00
|
|
|
command echo "This is the process whose exit event should be blocked"
|
2020-01-13 19:34:22 +00:00
|
|
|
echo "This should come before the event handler"
|
2019-02-21 05:41:35 +00:00
|
|
|
end
|
|
|
|
test_blocks
|
2021-05-17 21:34:52 +00:00
|
|
|
# CHECK: This is the process whose exit event should be blocked
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: This should come before the event handler
|
|
|
|
|
2019-02-21 05:41:35 +00:00
|
|
|
echo "Now event handler should have run"
|
2019-06-26 18:07:46 +00:00
|
|
|
# CHECK: PROCESS_EXIT 0
|
|
|
|
# CHECK: JOB_EXIT 0
|
|
|
|
# CHECK: Now event handler should have run
|
|
|
|
# CHECK: PROCESS_EXIT 0
|