aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authornicolas.pouillard <nicolas.pouillard@gmail.com>2008-01-05 23:55:00 +0100
committernicolas.pouillard <nicolas.pouillard@gmail.com>2008-01-05 23:55:00 +0100
commit3a025d6e7c4158e3380ab469a0daf5d95781fdea (patch)
tree8c73a33c64758e2d1705335e48d8d646bab34363 /XMonad
parent85792dc5fe5ee9d02046f059f7a2c58fbd824026 (diff)
downloadxmonad-3a025d6e7c4158e3380ab469a0daf5d95781fdea.tar.gz
xmonad-3a025d6e7c4158e3380ab469a0daf5d95781fdea.tar.xz
xmonad-3a025d6e7c4158e3380ab469a0daf5d95781fdea.zip
The recompile function now returns a boolean status instead of ().
darcs-hash:20080105225500-94725-1c05ae81351eaadb4f736e0d665f325618d76dbe.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Core.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index 9252b05..56afe1b 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -348,7 +348,9 @@ getXMonadDir = io $ getAppUserDataDirectory "xmonad"
-- GHC indicates failure with a non-zero exit code, an xmessage containing
-- GHC's is spawned.
--
-recompile :: MonadIO m => Bool -> m ()
+-- False is returned if there is compilation errors.
+--
+recompile :: MonadIO m => Bool -> m Bool
recompile force = io $ do
dir <- getXMonadDir
let binn = "xmonad-"++arch++"-"++os
@@ -358,7 +360,8 @@ recompile force = io $ do
src = base ++ ".hs"
srcT <- getModTime src
binT <- getModTime bin
- when (force || srcT > binT) $ do
+ if (force || srcT > binT)
+ then do
status <- bracket (openFile err WriteMode) hClose $ \h -> do
waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-no-recomp", "-v0", "-o",binn] (Just dir)
Nothing Nothing Nothing (Just h)
@@ -370,6 +373,8 @@ recompile force = io $ do
["Error detected while loading xmonad configuration file: " ++ src]
++ lines ghcErr ++ ["","Please check the file for errors."]
doubleFork $ executeFile "xmessage" True [msg] Nothing
+ return (status == ExitSuccess)
+ else return True
where getModTime f = catch (Just <$> getModificationTime f) (const $ return Nothing)
-- | Run a side effecting action with the current workspace. Like 'when' but