[Haskell-cafe] runInteractiveCommand dying uncatchably?
martine at danga.com
Sat Mar 1 13:39:37 EST 2008
If I run the following program, it never prints "done". If I
uncomment the commented line, it does.
import Prelude hiding (catch)
demo = do
(inp,out,err,pid) <- runInteractiveCommand "nonesuchcommand"
putStrLn "writing to in on bad command"
hPutStr inp "whatever"
-- putStr "flushing"
hFlush inp `catch` \e -> do print e; return ()
main = demo `catch` \e -> do print e; return ()
On my machine the output is:
$ runhaskell test.hs
writing to in on bad command
It appears to exit at the hFlush call. (hClose has the same behavior.)
I find this surprising -- I'd expect, even if I'm using an API
incorrectly, to get an exception.
More information about the Haskell-Cafe