[Haskell-cafe] runProcess does not care about hSetBuffering?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Tue Jul 28 21:22:26 EDT 2009


On Jul 28, 2009, at 21:14 , Magicloud Magiclouds wrote:
> (or_, ow_) <- createPipe
> or <- fdToHandle or_
> ow <- fdToHandle ow_
> hSetBuffering ow LineBuffering
> hSetBuffering or LineBuffering
> h <- runProcess cmd [] Nothing Nothing Nothing (Just ow) Nothing
>  In the cmd process, the ow is not LineBuffering....

Buffering is not an attribute of a filehandle, but of the I/O  
library.  There is no way for you to tell cmd how you want it to  
buffer, unless it has an option to do so (cat -u, tcpdump -l, etc.),  
although you can hint by using a pty instead of a pipe:  many programs  
will switch to line buffering in that case, some will go unbuffered;  
usually, a pipe, FIFO, or ordinary file will be block buffered.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090728/d7ccfe3f/PGP.bin


More information about the Haskell-Cafe mailing list