[Haskell-cafe] Execution of external command

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Dec 13 09:08:34 EST 2007


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 at gmail.com



More information about the Haskell-Cafe mailing list