From: Dan C. <dan...@co...> - 2005-07-29 14:46:55
|
The following simple test generates a broken pipe error writing to *stream* in format (running the latest CVS 2.34 on Linux (FC4)). Any suggestions as to what I'm doing wrong? > (defvar *stream*) > > (setq *stream* > (ext:run-program "cat" > :arguments nil > :input ':stream > :output ':stream > :wait nil)) > > (format *stream* "abcd") > (terpri *stream*) > (finish-output *stream*) > (print (read-line *stream*)) > > (close (two-way-stream-input-stream *stream*)) > (close (two-way-stream-output-stream *stream*)) > (close *stream*) |
From: Sam S. <sd...@gn...> - 2005-07-29 15:56:46
|
> * Dan Corkill <qna...@pb...g> [2005-07-29 10:46:46 -0400]: > > The following simple test generates a broken pipe error writing to > *stream* in format > (running the latest CVS 2.34 on Linux (FC4)). Any suggestions as to > what I'm doing wrong? ":wait nil" means "exec cat &", i.e., cat does not wait for your input and terminates right away. >> (defvar *stream*) >> >> (setq *stream* >> (ext:run-program "cat" >> :arguments nil >> :input ':stream >> :output ':stream >> :wait nil)) >> >> (format *stream* "abcd") >> (terpri *stream*) >> (finish-output *stream*) >> (print (read-line *stream*)) >> >> (close (two-way-stream-input-stream *stream*)) >> (close (two-way-stream-output-stream *stream*)) >> (close *stream*) use (ext:run-program "cat" :arguments nil :input ':stream :output ':stream)) or just (ext:make-pipe-io-stream "cat") -- Sam Steingold (http://www.podval.org/~sds) running w2k <http://www.memri.org/> <http://pmw.org.il/> <http://www.iris.org.il> <http://www.jihadwatch.org/> <http://ffii.org/> Vegetarians eat Vegetables, Humanitarians are scary. |
From: Matthias B. <mk...@in...> - 2005-07-29 16:01:59
|
Dan Corkill wrote: >The following simple test generates a broken pipe error writing to >*stream* in format >(running the latest CVS 2.34 on Linux (FC4)). Any suggestions as to >what I'm doing wrong? Try :wait t instead of nil. Then it works here (FreeBSD 5.4). Why have you set it to nil? The default is T. mkb. |
From: Dan C. <dan...@co...> - 2005-07-29 16:27:43
|
>":wait nil" means "exec cat &", i.e., cat does not wait for your input >and terminates right away. > > Many thanks. I should have read the docs more carefully. The example does work correctly with :wait 't. I assumed that :wait controlled whether the run-program call returned immediately or waited for the command to terminate (the typical behavior of :wait for similar interfaces in many other CLs). BTW, is there a way to obtain the "wait for the run-program command to exit before proceeding" behavior in CLISP (the equivalent of specifying :wait 't in those other implementations)? Thanks again for the speedy advice! -- Dan |
Re: [clisp-list] Re: Broken pipe problem using ext:run-program under Linux (using
latest CLISP 2.34)
From: Pascal B. <pj...@in...> - 2005-07-29 18:04:46
|
Dan Corkill writes: > > >":wait nil" means "exec cat &", i.e., cat does not wait for your input > >and terminates right away. > > > > > Many thanks. I should have read the docs more carefully. The example > does work > correctly with :wait 't. I assumed that :wait controlled whether the > run-program > call returned immediately or waited for the command to terminate (the > typical > behavior of :wait for similar interfaces in many other CLs). > > BTW, is there a way to obtain the "wait for the run-program command to exit > before proceeding" behavior in CLISP (the equivalent of specifying :wait > 't in > those other implementations)? > > Thanks again for the speedy advice! This is what is done when input and output are both not :stream. clisp is not dumb. When it sees it'll have to work, it doesn't wait. -- __Pascal Bourguignon__ http://www.informatimago.com/ |