Exit with status 1 on error

This commit is contained in:
Niklas Hambüchen 2013-08-23 11:30:07 +09:00
parent 41de7a54a2
commit 35f40b3ce9
1 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import Prelude
import System.Console.GetOpt
import System.Directory
import System.Environment (getArgs)
import System.Exit (exitFailure)
import System.IO (hPutStr, hPutStrLn, stdout, stderr, hSetEncoding, utf8)
----------------------------------------------------------------
@ -113,7 +114,8 @@ main = flip catches handlers $ do
cmd -> throw (NoSuchCommand cmd)
putStr res
where
handlers = [Handler handler1, Handler handler2]
handlers = [Handler (handleThenExit handler1), Handler (handleThenExit handler2)]
handleThenExit handler = \e -> handler e >> exitFailure
handler1 :: ErrorCall -> IO ()
handler1 = print -- for debug
handler2 :: GHCModError -> IO ()