2015-12-22 17:02:15 +00:00
|
|
|
--- a/src/XMonad/Core.hs
|
|
|
|
+++ b/src/XMonad/Core.hs
|
|
|
|
@@ -48,6 +48,7 @@ import System.Posix.Types (ProcessID)
|
2013-12-12 21:33:51 +00:00
|
|
|
import System.Process
|
|
|
|
import System.Directory
|
|
|
|
import System.Exit
|
|
|
|
+import System.Environment (lookupEnv)
|
|
|
|
import Graphics.X11.Xlib
|
|
|
|
import Graphics.X11.Xlib.Extras (Event)
|
|
|
|
import Data.Typeable
|
2015-12-22 17:02:15 +00:00
|
|
|
@@ -463,6 +464,7 @@ recompile force = io $ do
|
2013-12-12 21:33:51 +00:00
|
|
|
err = base ++ ".errors"
|
|
|
|
src = base ++ ".hs"
|
|
|
|
lib = dir </> "lib"
|
2015-03-08 15:36:37 +00:00
|
|
|
+ ghc <- fromMaybe "ghc" <$> liftIO (lookupEnv "NIX_GHC")
|
2013-12-12 21:33:51 +00:00
|
|
|
libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib
|
|
|
|
srcT <- getModTime src
|
|
|
|
binT <- getModTime bin
|
2015-12-22 17:02:15 +00:00
|
|
|
@@ -471,7 +473,7 @@ recompile force = io $ do
|
2013-12-12 21:33:51 +00:00
|
|
|
-- temporarily disable SIGCHLD ignoring:
|
|
|
|
uninstallSignalHandlers
|
|
|
|
status <- bracket (openFile err WriteMode) hClose $ \h ->
|
2015-12-22 17:02:15 +00:00
|
|
|
- waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-main-is", "main", "-v0", "-o",binn] (Just dir)
|
|
|
|
+ waitForProcess =<< runProcess ghc ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-main-is", "main", "-v0", "-o",binn] (Just dir)
|
2013-12-12 21:33:51 +00:00
|
|
|
Nothing Nothing Nothing (Just h)
|
|
|
|
|
|
|
|
-- re-enable SIGCHLD:
|
2015-12-22 17:02:15 +00:00
|
|
|
@@ -480,6 +482,7 @@ recompile force = io $ do
|
2013-12-12 21:33:51 +00:00
|
|
|
-- now, if it fails, run xmessage to let the user know:
|
|
|
|
when (status /= ExitSuccess) $ do
|
|
|
|
ghcErr <- readFile err
|
|
|
|
+ xmessage <- fromMaybe "xmessage" <$> liftIO (lookupEnv "XMONAD_XMESSAGE")
|
|
|
|
let msg = unlines $
|
|
|
|
["Error detected while loading xmonad configuration file: " ++ src]
|
|
|
|
++ lines (if null ghcErr then show status else ghcErr)
|
2015-12-22 17:02:15 +00:00
|
|
|
@@ -487,7 +490,7 @@ recompile force = io $ do
|
2013-12-12 21:33:51 +00:00
|
|
|
-- nb, the ordering of printing, then forking, is crucial due to
|
|
|
|
-- lazy evaluation
|
|
|
|
hPutStrLn stderr msg
|
|
|
|
- forkProcess $ executeFile "xmessage" True ["-default", "okay", msg] Nothing
|
|
|
|
+ forkProcess $ executeFile xmessage True ["-default", "okay", msg] Nothing
|
|
|
|
return ()
|
|
|
|
return (status == ExitSuccess)
|
|
|
|
else return True
|