diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-06-20 16:16:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-06-20 16:16:50 -0700 |
commit | ebc91159198aabf8d1bd3e03d9cee807b5b97902 (patch) | |
tree | 9a043483c58a43ce232051166d9807f30889b927 /tests/018 | |
parent | a9835d6c37d2a3c762c4620294d0b2a13d543ccb (diff) | |
download | txr-ebc91159198aabf8d1bd3e03d9cee807b5b97902.tar.gz txr-ebc91159198aabf8d1bd3e03d9cee807b5b97902.tar.bz2 txr-ebc91159198aabf8d1bd3e03d9cee807b5b97902.zip |
subprocesses: a few test cases.
* tests/018/process.tl: New file.
Diffstat (limited to 'tests/018')
-rw-r--r-- | tests/018/process.tl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/018/process.tl b/tests/018/process.tl new file mode 100644 index 00000000..b34047b2 --- /dev/null +++ b/tests/018/process.tl @@ -0,0 +1,18 @@ +(load "../common") + +(defun cmd (c : (m "r")) + (with-stream (s (open-command c m)) + (get-string s))) + +(mtest + (cmd "echo foo") "foo\n" + (cmd "echo foo" ">1n") "" + (cmd "echo foo 1>&2" ">21") "foo\n") + +(defmacro fcmd (. forms) + ^(with-stream (s (open-subprocess nil "r" nil (lambda () ,*forms))) + (get-string s))) + +(mtest + (fcmd (let ((*stdout* *stdnull*)) (sh "echo foo"))) "" + (fcmd (let ((*stderr* *stdout*)) (sh "echo foo 1>&1"))) "foo\n") |