RE: Subprocesses (was: [ANNOUNCE] shell-haskell 1.0.0)
One thing I'd like to see would be a version that accepts a string as the standard input, and perhaps gives a lazy string as the standard output. At least in its current incarnation, I don't see how this can trivially be implemented on top of launch, since it would generally fail on input strings longer than 4k in length due to buffering issues, as the write of the string will block when the buffer is full.
Just fork a thread to write to the input pipe. Looking at the implementation of POpen.popen, it appears that it could do exactly that. Cheers, Simon
2003年05月09日(金)の21時33分に Simon Marlow 曰く:
One thing I'd like to see would be a version that accepts a string as the standard input, and perhaps gives a lazy string as the standard output. At least in its current incarnation, I don't see how this can trivially be implemented on top of launch, since it would generally fail on input strings longer than 4k in length due to buffering issues, as the write of the string will block when the buffer is full.
Just fork a thread to write to the input pipe. Looking at the implementation of POpen.popen, it appears that it could do exactly that.
Agreed, that is what POpen should do really. Jens ps There is also "SubProcess.lhs" by Sebastien Carlier <sebc@wise-language.org>, which I had been wanting to fold into POpen, but using threads would probably be better, as long as they play along nicely with forking.
participants (2)
-
Jens Petersen -
Simon Marlow