
Bulat Ziganshin wrote:
...are there any objections against...
(_, h, _, _) <- runInteractiveCommand "script params" output <- hGetContents h
taking into account that bad-behaved scripts are not my headache?
"bad-behaved scripts are not my headache" is not the same as "behave nicely". Or I guess they are the same - if they don't behave nicely, then they are your headache whether you like it or not. :) Simon Marlow wrote:
It could deadlock if the script produces enough stderr to fill up its pipe buffer
If we need to worry about that, then what about this: (_,h,e,_) <- runInteractiveCommand "script params" forkIO (hGetContents e >>= evaluate . length) output <- hGetContents h It requires -threaded in the case of a huge amount of output to both stdout and stderr; maybe that isn't good for Bulat. If that is a problem, you can read a chunk at a time and call yield - but that is getting messier. Thanks, Yitz