
13 Dec
2007
13 Dec
'07
9:08 a.m.
Hello Duncan, Thursday, December 13, 2007, 4:51:20 PM, you wrote:
OK, I'll bite. What's wrong with runInteractiveCommand?
It requires threads because you have to pull from both the stdout and stderr to prevent blocking. You could do it with non-blocking reads but not without busy-waiting.
may be this will be ok (with -threaded)? (_, stdout, stderr, _) <- runInteractiveCommand "script params" forkIO (hGetContents stderr >>= evaluate.length) result <- hGetLine stdout hGetContents stdout >>= evaluate.length awkward, but still shorter than code from Cabal to Yitzchak: and you've asked what's wrong with runInteractiveCommand? :))) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com