[plt-scheme] Process hangs with big input
I wonder if this is the problem that setup has with decompressing large
files. It also is multi-threaded.
> -----Original Message-----
> From: plt-scheme-bounces at list.cs.brown.edu [mailto:plt-scheme-
> bounces at list.cs.brown.edu] On Behalf Of Robby Findler
> Sent: Tuesday, March 14, 2006 7:33 AM
> To: Noel Welsh
> Cc: plt-scheme
> Subject: Re: [plt-scheme] Process hangs with big input
>
> Yes, the ports created by process are buffered.
>
> If you have a lot of output and can do something with it as it comes
> (rather than waiting until it all shows up), it is probably better to
> just work directly with the ports, rather than waiting for the process
> to finish and creating intermediate strings. The combination of our
> new(ish) ports library and CML-style message passing concurrency makes
> this easy to do and it scales to lots of data.
>
> If, however, you really want the output in a string, create a pipe and
> a thread. Have the thread copy the out and/or err to one side of the
> pipe and get a string from the other side of the pipe (don't forget to
> have the thread close the ports when it is done copying). Pipes can be
> created with an internal buffer that is unbounded.
>
> What are you doing, in this particular case?
>
> Robby
>
> At Tue, 14 Mar 2006 06:23:54 -0800 (PST), Noel Welsh wrote:
> > Hi all,
> >
> > I'm trying to control an external process (svn) using the
> > process function in (lib "process.ss") I want to capture
> > the output so I've wrapped process in this fucntion from
> > the Scheme Cookbook:
> >
> > (define (system/output command-string)
> > (let-values (((out in id err ctrl)
> > (apply values (process command-string))))
> > (ctrl 'wait) ;; wait for the process to finish
> > (begin0
> > (case (ctrl 'status)
> > ((done-ok)
> > (port->string out))
> > (else #f))
> > (close-output-port in)
> > (close-input-port out)
> > (close-input-port err))))
> >
> >
> > When the process creates a small amount of output
> > system/output terminates. When the process creates a large
> > amount of output it never terminates. Debugging by hand I
> > always get:
> >
> > > (ctrl 'status)
> > running
> >
> > Could there be a buffer that fills up, preventing the
> > process from writing my output and terminating. Looking
> > through process.ss has not shed much light.
> >
> > Thanks,
> > Noel
> >
> > Email: noelwelsh <at> yahoo <dot> com noel <at> untyped <dot> com
> > AIM: noelhwelsh
> > Blogs: http://monospaced.blogspot.com/ http://www.untyped.com/untyping/
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> > _________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme