diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-06-21 07:28:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-06-21 07:28:53 -0700 |
commit | f7942e319816ddff862017112aadc3f14fb73e81 (patch) | |
tree | a849aecf81b71ce8d7af46437f23b6797484950c /parser.c | |
parent | 8446eac7ee6ecc8b80b0715745b5fd0d56948adc (diff) | |
download | txr-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 'parser.c')
-rw-r--r-- | parser.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1947,7 +1947,7 @@ static mem_t *lino_open8(const char *name_in, lino_file_mode_t mode_in) static mem_t *lino_fdopen(int fd, lino_file_mode_t mode_in) { val mode = static_str(lino_mode_str[mode_in]); - return coerce(mem_t *, open_fileno(num(fd), mode)); + return coerce(mem_t *, open_fileno(num(fd), mode, nil)); } static void lino_close(mem_t *stream) |