summaryrefslogtreecommitdiffstats
path: root/tests/018
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-06-21 07:28:53 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-06-21 07:28:53 -0700
commitf7942e319816ddff862017112aadc3f14fb73e81 (patch)
treea849aecf81b71ce8d7af46437f23b6797484950c /tests/018
parent8446eac7ee6ecc8b80b0715745b5fd0d56948adc (diff)
downloadtxr-f7942e319816ddff862017112aadc3f14fb73e81.tar.gz
txr-f7942e319816ddff862017112aadc3f14fb73e81.tar.bz2
txr-f7942e319816ddff862017112aadc3f14fb73e81.zip
bugfix: missing gzip support in open-command.
* stream.c (pipe_close_status_helper): New function, factored out of pipe_close and used by it, and also by gzio_close. (pipe_close): Call pipe_close, which now contains the classification of process wait status codes. (open_fileno): Now takes optional pid argument. If this specified, then make_pipevp_stream is used. (open_subprocess): Use the open_fileno function, rather than fopen. This simplifies things too, except that we have to catch exception. Pass pid to the newly added parameter of open_fileno so that we obtain a proper pipe stream that will wait for the process to terminate when closed. (mkstemp_wrap): Pass nil for pid argument of open_fileno. (stream_init): Update registration of open-fileno. * gzio.c (struct gzio_handle): New member, pid. (gzio_close): If there is a nonzero pid, wait for the process to terminate. (make_gzio_stream): Initialize h->pid to zero. (make_gzio_pipe_stream): New function. * parser.c (lino_fdopen): Pass nil for pid argument of open_fileno. * gzio.h (make_gzio_pipe_stream): Declared. * tests/018/gzip.tl: New test.
Diffstat (limited to 'tests/018')
-rw-r--r--tests/018/gzip.tl4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/018/gzip.tl b/tests/018/gzip.tl
index 3e7c9ef9..c6d5767e 100644
--- a/tests/018/gzip.tl
+++ b/tests/018/gzip.tl
@@ -51,3 +51,7 @@
(with-out-string-stream (*stdout*)
(load "./test-file-combined.tlo.gz"))
"a\nb\n"))
+
+(when %have-gzip%
+ (with-stream (s (open-command "echo abc | gzip -c" "z"))
+ (test (get-line s) "abc")))