summaryrefslogtreecommitdiffstats
path: root/tests/018/forkflush.tl
blob: 296cec02ddca27721fa37212d44366b12da24c56 (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
(load "../common")

(defvarl os (os-symbol))

(push-after-load (remove-path "tmpfile"))

(with-stream (*stdout* (open-file "tmpfile" "w"))
  (cond
    ((eq os :cygwin)
       (put-string "A\nB\nC\nD\n"))
    (t (put-line "A")
       (sh "echo B")
       (put-line "C")
       (sh "echo D"))))

(put-string (file-get-string "tmpfile"))

(with-stream (*stdout* (open-file "tmpfile" "w"))
  (put-line "E")
  (with-stream (s (open-process "cat" "w"))
    (put-line "F" s))
  (put-line "G")
  (with-stream (s (open-process "cat" "w"))
    (put-line "H" s)))

(put-string (file-get-string "tmpfile"))

(with-stream (*stdout* (open-file "tmpfile" "w"))
  (put-line "I")
  (with-stream (s (open-command "cat" "w"))
    (put-line "J" s))
  (put-line "K")
  (with-stream (s (open-command "cat" "w"))
    (put-line "L" s)))

(put-string (file-get-string "tmpfile"))