aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Cheplyaka <roma@ro-che.info>2009-02-16 22:38:42 +0100
committerRoman Cheplyaka <roma@ro-che.info>2009-02-16 22:38:42 +0100
commita0854ba8df2b837ede780a2db57a0337deaad73f (patch)
tree828ee690ef2487fe285129a58c569e2274fa0993
parentecad0402f8bd1c70a1fc0801d027313e1321f2bd (diff)
downloadXMonadContrib-a0854ba8df2b837ede780a2db57a0337deaad73f.tar.gz
XMonadContrib-a0854ba8df2b837ede780a2db57a0337deaad73f.tar.xz
XMonadContrib-a0854ba8df2b837ede780a2db57a0337deaad73f.zip
X.U.Loggers: handle possible EOF (reported by dyfrgi)
darcs-hash:20090216213842-3ebed-958cbc985ea9e5f72ac0d0b63c7544947e31d134.gz
-rw-r--r--XMonad/Util/Loggers.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/XMonad/Util/Loggers.hs b/XMonad/Util/Loggers.hs
index 35892fd..4c879a7 100644
--- a/XMonad/Util/Loggers.hs
+++ b/XMonad/Util/Loggers.hs
@@ -83,6 +83,5 @@ battery = logCmd "/usr/bin/acpi | sed -r 's/.*?: (.*%).*/\\1/; s/discharging, ([
-- | Create a 'Logger' from an arbitrary shell command.
logCmd :: String -> Logger
logCmd c = io $ do (_, out, _, _) <- runInteractiveCommand c
- output <- hGetLine out
+ fmap Just (hGetLine out) `catch` (const $ return Nothing)
-- no need to waitForProcess, we ignore SIGCHLD
- return $ Just output