Hi, I would like to read and uncompress a .gz file on Linux on the
fly.
I tried something like
(let* ((instance (sb-ext:run-program "zcat" '("/tmp/test.gz")
:output :stream))
(stream (sb-ext:process-output instance)))
(display-stream stream))
where display-stream is simply
(defun display-stream (stream)
"Display stream line by line until EOF."
(tagbody
top
(let ((line (read-line stream nil nil)))
(when line
(format t "~a~%" line)
(go top)))))
but I get no output. The file exists:
$ zcat /tmp/test.gz
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.
and the uncompressed, non-piped version is read just fine with
(with-open-file (stream "/tmp/test")
(display-stream stream))
I would appreciate any help on what I am doing wrong.
Tamas
|