runInteractiveProcess and buffering

Henning Thielemann lemming at henning-thielemann.de
Fri Oct 12 16:17:01 EDT 2007


It looks like my problem has to do with buffering, but I don't know how to 
solve it.


main :: IO ()
main =
    do (inp,out,err,pid) <-
          runInteractiveProcess "aseqdump" ["-p", "72:0"] Nothing Nothing
       hSetBuffering out NoBuffering
       hGetBuffering out >>= print
       hGetLine out >>= putStrLn
       return ()


The data of 'out' seems to be buffered, because 'aseqdump' must produce 
many lines until even the first one is returned by 'hGetLine' and printed 
by 'putStrLn'. I tried to disable buffering for 'out' and indeed 
'NoBuffering' is printed to the terminal, but the output from 'aseqdump' 
is still deferred.


More information about the Libraries mailing list