File: job-ids.fish

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (55 lines) | stat: -rw-r--r-- 984 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# RUN: %fish %s

# Ensure that job IDs are sequential.

status job-control full

set -g tokill

function func100
    sleep 100 &
    set -g tokill $tokill $last_pid
end
func100

# The redirection ensures this becomes a real job.
begin
    sleep 200 &
    set -g tokill $tokill $last_pid
end </dev/null


sleep 300 &
set -g tokill $tokill $last_pid

jobs

#CHECK: Job	Group{{.*}}
#CHECK: 3{{.*\t}}sleep 300 &
#CHECK: 2{{.*\t}}sleep 200 &
#CHECK: 1{{.*\t}}sleep 100 &

# Kill job 2; the next job should have job ID 4 because 3 is still in use (#6053).

status job-control interactive
command kill -9 $tokill[2]
# Wait for the job to die - the signal needs to be delivered.
wait $tokill[2] 2>/dev/null
set -e tokill[2]
status job-control full
sleep 400 &
set -g tokill $tokill $last_pid

jobs

#CHECK: Job	Group{{.*}}
#CHECK: 4{{.*\t}}sleep 400 &
#CHECK: 3{{.*\t}}sleep 300 &
#CHECK: 1{{.*\t}}sleep 100 &


status job-control interactive

for pid in $tokill
    command kill -9 $pid
end