[Haskell-cafe] Unexpected results from ExitCode
ps.haskell at gmail.com
Wed Nov 3 23:45:14 EDT 2010
I have a program (test.hs):
> module Main (main) where
> import System.Exit
> main :: IO ExitCode
> main = do
> return (ExitFailure 1)
In another program, I invoke it via 'system':
> exitCode <- system ".\\test.exe"
> case (exitCode) of
> ExitFailure failCnt -> do
> putStrLn $ "-- Fail count is: " ++ show failCnt
> ExitSuccess -> do
> putStrLn $ "-- OK."
but it always gets ExitSuccess (not ExitFailure failCnt as I expected).
(I am running under Windows.)
My other use of system (such as with ghc commands) works okay,
sometimes getting success, sometimes failure, as expected.
Any suggestions much appreciated.
More information about the Haskell-Cafe