diff options
author | David Roundy <droundy@darcs.net> | 2007-06-11 17:36:50 +0200 |
---|---|---|
committer | David Roundy <droundy@darcs.net> | 2007-06-11 17:36:50 +0200 |
commit | a95f379074d83b6519e9ffd2ec905a6c131969c9 (patch) | |
tree | 973c94513ea7b5506ad43cfc2d5e182f59c960ca | |
parent | 110abbab167572519fc3d8d12c92bd7ee483502d (diff) | |
download | xmonad-a95f379074d83b6519e9ffd2ec905a6c131969c9.tar.gz xmonad-a95f379074d83b6519e9ffd2ec905a6c131969c9.tar.xz xmonad-a95f379074d83b6519e9ffd2ec905a6c131969c9.zip |
add safeIO which catches and logs exceptions.
darcs-hash:20070611153650-72aca-c802f2ac167c0e9232d17a2897163aca5a5479f0.gz
-rw-r--r-- | XMonad.hs | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -17,7 +17,7 @@ module XMonad ( X, WindowSet, WorkspaceId(..), ScreenId(..), XState(..), XConf(..), Layout(..), Typeable, Message, SomeMessage(..), fromMessage, - runX, io, withDisplay, withWindowSet, isRoot, spawn, restart, trace, whenJust, whenX, + runX, io, safeIO, withDisplay, withWindowSet, isRoot, spawn, restart, trace, whenJust, whenX, atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW ) where @@ -137,6 +137,9 @@ fromMessage (SomeMessage m) = cast m io :: IO a -> X a io = liftIO +safeIO :: IO () -> X () +safeIO f = liftIO (f `catch` \e -> do hPutStrLn stderr (show e); hFlush stderr) + -- | spawn. Launch an external application spawn :: String -> X () spawn x = io $ do |