summaryrefslogtreecommitdiffstats
path: root/XMonad.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-10-12 17:28:01 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-10-12 17:28:01 +0200
commit2bb2f5e28f14d0d31762acd6c54612b34d911c55 (patch)
treebacc45f67f2966090f68875b4d3eb3b0b505dc91 /XMonad.hs
parent8576d74f6ab0f5ae424fb5c4b961851be3305712 (diff)
downloadmetatile-2bb2f5e28f14d0d31762acd6c54612b34d911c55.tar
metatile-2bb2f5e28f14d0d31762acd6c54612b34d911c55.zip
Respect ExitExceptions, fixes a regression where exitWith had no effect
darcs-hash:20071012152801-a5988-80a14dda451e1e6e7cdc9e42fdc11568c21004b2
Diffstat (limited to 'XMonad.hs')
-rw-r--r--XMonad.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/XMonad.hs b/XMonad.hs
index f124d7e..5a39661 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -25,7 +25,7 @@ module XMonad (
import StackSet
import Prelude hiding ( catch )
-import Control.Exception ( catch )
+import Control.Exception (catch, throw, Exception(ExitException))
import Control.Monad.State
import Control.Monad.Reader
import System.IO
@@ -87,11 +87,13 @@ runX c st (X a) = runStateT (runReaderT a c) st
-- | Run in the X monad, and in case of exception, and catch it and log it
-- to stderr, and run the error case.
catchX :: X a -> X a -> X a
-catchX (X job) (X errcase) = do
+catchX job errcase = do
st <- get
c <- ask
- (a,s') <- io ((runStateT (runReaderT job c) st) `catch`
- \e -> (do hPutStrLn stderr (show e); runStateT (runReaderT errcase c) st))
+ (a, s') <- io $ runX c st job `catch`
+ \e -> case e of
+ ExitException {} -> throw e
+ _ -> do hPrint stderr e; runX c st errcase
put s'
return a