chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] gnuplot subprocess: python->chicken


From: Peter Bex
Subject: Re: [Chicken-users] gnuplot subprocess: python->chicken
Date: Tue, 30 Apr 2013 20:29:37 +0200
User-agent: Mutt/1.4.2.3i

On Tue, Apr 30, 2013 at 08:25:25PM +0200, Peter Bex wrote:
> On Tue, Apr 30, 2013 at 10:41:14AM -0700, Bryan Vicknair wrote:
> > 
> >     (define go
> >       (lambda ()
> >         (define-values (i o pid stderr) (process* "gnuplot"))
> >         (write-line cmd o)
> >         (write-line "exit" o)
> > 
> >         ; Hangs trying to read stderr.
> >         (let ((err (read-string #f stderr)))
> >           (if (> (string-length err) 0)
> >             (error err)
> >             (begin
> >               (close-input-port i)
> >               (close-output-port o)
> >               )))))
> > 
> > 
> > The Chicken example hangs when I try to read stderr.
> 
> That's probably normal, as there's no data on stderr and the pipe isn't
> closed until the program finishes.

Sorry, I think I didn't word that very well.  The reason is that gnuplot
is still waiting for input.  Read-string will read the warning message,
but will keep waiting for more (which never arrives) until gnuplot closes
stderr (which will happen only on exit).  Meanwhile, gnuplot is waiting
for more input on stdin.

So you can fix this rather easily by calling (close-output-port o)
before reading from stderr.

Cheers,
Peter
-- 
http://www.more-magic.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]