Ticket #318 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

RUN-PROGRAM I/O limitations

Reported by: gb Owned by: gb
Priority: major Milestone:
Component: Foreign Function Interface Version: unspecific
Keywords: Cc:

Description

 (run-program ''prog'' args :output ''lisp-stream'' :error ''lisp-stream'')

doesn't work as expected. CCL::MONITOR-EXTERNAL-PROCESS only has the ability to watch output on a single file descriptor, and in this case it winds up watching the input side of a pipe used as the error descriptor by the external program, and output is lost.

Example:

(defun foo ()
  (with-output-to-string (out)
    (with-output-to-string (err)
      (run-program "ls" '("-l") :output out :error err)
      (format t "~& out = ~a" (get-output-stream-string out))
      (format t "~& err = ~a" (get-output-stream-string err))))
  nil)

Calling (FOO) produces the output:

out =
err =

which basically means "there was no error output, and we weren't watching standard output"

Even though this is apparently a litte obscure (I don't recall it ever having been reported), it's probably fair to call it 'major'.

Using :ERROR :OUTPUT provides a way of getting both standard and error output, but not a way of distinguishing between them.

Change History

comment:1 Changed 6 years ago by rs

using :stream as the argument for output and error works like expected. (it's just somewhat inconvenient to read out the streams...)

comment:2 in reply to: ↑ description Changed 6 years ago by danieldickison

Another related issue (from openmcl-devel): when you specify different streams for :error and :output, one of the pipe's file descriptor remains open indefinitely.

comment:3 Changed 6 years ago by rme

  • Milestone 1.2 deleted

Milestone 1.2 deleted

comment:4 Changed 6 years ago by gb

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.