blob: ab64ecd61a109073c3ef6c99436c706033503bb3 (
plain)
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
56
57
|
# Interactive: job control.
command -v python3 >/dev/null 2>&1 || exit 77
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" <<'END' |
send sleep 30\r
wait 0.3
send \x1a
expect Stopped
send jobs\r
expect sleep 30
send bg\r
send jobs\r
expect Running
send fg\r
wait 0.3
send \x03
wait 0.2
send echo after=$?\r
expect after=130
send sleep 0.2 &\r
wait 0.6
send \r
expect Done
send cat | wc -l\r
wait 0.2
send a\rb\r\x04
expect 2
# a stopped pipeline is one job
send sleep 31 | sleep 32\r
wait 0.3
send \x1a
expect Stopped
send sleep 33 &\r
send jobs\r
expect sleep 33
send kill %1 %2\r
send wait\r
send jobs\r
# ^C during a compound command abandons the rest of the line
send sleep 30; echo not-run\r
wait 0.3
send \x03
wait 0.2
send echo st=$?\r
expect st=130
# a subshell is a job too
send (sleep 34)\r
wait 0.3
send \x1a
expect Stopped
send exit\r
expect stopped jobs
send kill %1; wait\r
send set +m; sleep 0.1 & wait; echo no-monitor\r
expect no-monitor
send exit\r
END
sed 's/^\(\[[0-9]*\]\) [0-9][0-9]*$/\1 PID/'
|