diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-23 09:35:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-23 09:35:56 -0700 |
commit | d9b8b8f7a7377381e296203314ddd9b19bd32216 (patch) | |
tree | bac6b8f48a8467713a2680c911ee9be399280721 /tests/018 | |
parent | 13b0bb55246a427735f9f77c6d778c1597f6be4d (diff) | |
download | txr-d9b8b8f7a7377381e296203314ddd9b19bd32216.tar.gz txr-d9b8b8f7a7377381e296203314ddd9b19bd32216.tar.bz2 txr-d9b8b8f7a7377381e296203314ddd9b19bd32216.zip |
fork/streams: new failing test.
This test case exemplifies code that will work as expected
when *stdout* is a TTY device, such that line buffering is
in effect, but then break when standard output is redirected
to a file.
The issue is that the controlling process is not flushing its
standard output when calling the external script, so the
script's output gets placed ahead of the process' own earlier
output.
* tests/018/forkflush.tl: New file.
* tests/018/forkflush.expected: New file.
Diffstat (limited to 'tests/018')
-rw-r--r-- | tests/018/forkflush.expected | 12 | ||||
-rw-r--r-- | tests/018/forkflush.tl | 31 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/018/forkflush.expected b/tests/018/forkflush.expected new file mode 100644 index 00000000..475f87b1 --- /dev/null +++ b/tests/018/forkflush.expected @@ -0,0 +1,12 @@ +A +B +C +D +E +F +G +H +I +J +K +L diff --git a/tests/018/forkflush.tl b/tests/018/forkflush.tl new file mode 100644 index 00000000..078fe2b9 --- /dev/null +++ b/tests/018/forkflush.tl @@ -0,0 +1,31 @@ +(load "../common") + +(push-after-load (remove-path "tmpfile")) + +(with-stream (*stdout* (open-file "tmpfile" "w")) + (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")) |