summary refs log tree commit diff
path: root/Misc/job-control-tests
blob: ecb9a7694cc2d2405987cca2ee16ad61633791ad (plain) (blame)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# These are some tests for the job control code.  The code chunks
# have to be run interactively.  Some use files in the zsh distribution.

# Try
#   ^Z
#   fg
if true; then cat Src/builtin.c | less; fi

# Try
#   ^Z
#   fg
fn() {
  if true; then cat Src/builtin.c | less; fi
}
fn

# Try
#   ^Z
#   fg
#   ^C
# then
#   ^Z
#   bg
#   kill
while true; do sed -e 's/foo/bar/' Src/builtin.c >/dev/null; done

# Try
#   ^C
# ignoring the error messages from sed.
# ^Z is more of a problem since you have to catch the sed.
while true; do sed -e 's/foo/bar/' non-existent-file >/dev/null; done

# Try
#   ^Z
#   fg
#   ^Z
#   fg
fn() {
  local a
  while read a; do :; done
  less "$@"
}
cat foo | fn bar

# Try
#   ^Z
#   fg
fn() {
  cat builtin.c
}
fn | while read a; do :; done

# Try
#   ^Z
#   fg
#   q
#   ^Z
#   fg
#   q
fn() {
  less builtin.c
  echo done
}
x=2; while (( x-- )); do f; done

# Try
#   ^C
# This won't work because zcat doesn't tell us that it received a signal.
# But
#   ^Z
#   fg
#   ^C (probably a second ^C is needed: if the continued zcat is still running)
# works.
# (See also the file Etc/BUGS)
while true; do zcat foo.gz > /dev/null; done