2020-02-08 16:44:39 +08:00
|
|
|
#RUN: %fish %s
|
2020-03-10 02:36:12 +08:00
|
|
|
jobs -q
|
|
|
|
echo $status
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECK: 1
|
2017-04-02 23:02:55 +08:00
|
|
|
sleep 5 &
|
|
|
|
sleep 5 &
|
2016-06-09 07:09:29 +08:00
|
|
|
jobs -c
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECK: Command
|
|
|
|
#CHECK: sleep
|
|
|
|
#CHECK: sleep
|
2020-03-10 02:36:12 +08:00
|
|
|
jobs -q
|
|
|
|
echo $status
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECK: 0
|
2018-04-02 04:43:05 +08:00
|
|
|
bg -23 1 2>/dev/null
|
2017-06-15 09:25:51 +08:00
|
|
|
or echo bg: invalid option -23 >&2
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECKERR: bg: invalid option -23
|
2016-07-06 14:12:28 +08:00
|
|
|
fg 3
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECKERR: fg: No suitable job: 3
|
2017-04-02 23:02:55 +08:00
|
|
|
bg 3
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECKERR: bg: Could not find job '3'
|
2017-03-23 08:50:57 +08:00
|
|
|
sleep 1 &
|
|
|
|
disown
|
|
|
|
jobs -c
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECK: Command
|
|
|
|
#CHECK: sleep
|
|
|
|
#CHECK: sleep
|
2017-03-23 08:50:57 +08:00
|
|
|
disown foo
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECKERR: disown: 'foo' is not a valid job specifier
|
2017-03-23 08:50:57 +08:00
|
|
|
disown (jobs -p)
|
2016-07-06 14:12:28 +08:00
|
|
|
or exit 0
|
2019-04-19 14:08:16 +08:00
|
|
|
|
2019-04-19 15:20:55 +08:00
|
|
|
# Verify `jobs` output within a function lists background jobs
|
2019-04-19 14:08:16 +08:00
|
|
|
# https://github.com/fish-shell/fish-shell/issues/5824
|
|
|
|
function foo
|
2019-04-19 15:20:55 +08:00
|
|
|
sleep 0.2 &
|
|
|
|
jobs -c
|
2019-04-19 14:08:16 +08:00
|
|
|
end
|
|
|
|
foo
|
2019-05-02 07:17:23 +08:00
|
|
|
|
|
|
|
# Verify we observe job exit events
|
|
|
|
sleep 1 &
|
|
|
|
set sleep_job $last_pid
|
|
|
|
function sleep_done_$sleep_job --on-job-exit $sleep_job
|
|
|
|
/bin/echo "sleep is done"
|
|
|
|
functions --erase sleep_done_$sleep_job
|
|
|
|
end
|
|
|
|
sleep 2
|
2019-09-11 13:17:23 +08:00
|
|
|
|
|
|
|
# Verify `jobs -l` works and returns the right status codes
|
|
|
|
# https://github.com/fish-shell/fish-shell/issues/6104
|
2020-03-10 02:36:12 +08:00
|
|
|
jobs --last --command
|
|
|
|
echo $status
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECK: Command
|
|
|
|
#CHECK: sleep
|
|
|
|
#CHECK: sleep is done
|
|
|
|
#CHECK: 1
|
2019-09-11 13:17:23 +08:00
|
|
|
sleep 0.2 &
|
2020-03-10 02:36:12 +08:00
|
|
|
jobs -lc
|
|
|
|
echo $status
|
2020-02-08 16:44:39 +08:00
|
|
|
#CHECK: Command
|
|
|
|
#CHECK: sleep
|
|
|
|
#CHECK: 0
|