summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2011-06-02 04:07:46 -0700
committerjao <jao@gnu.org>2011-06-02 04:07:46 -0700
commit21b6a84953c2fab5d48dc4bfe481a208c100b850 (patch)
tree1b8be8e7e2d034aa71cec449074e85e8d8b1c856 /src/Plugins/Monitors
parentf814701318ef4482e1e0d5b14f4225471996c670 (diff)
parent3a38c21f5b68abb8faab46fb37e126ffa70e2989 (diff)
downloadxmobar-21b6a84953c2fab5d48dc4bfe481a208c100b850.tar.gz
xmobar-21b6a84953c2fab5d48dc4bfe481a208c100b850.tar.bz2
Merge pull request #14 from mathstuf/dev/fix-battery-exceptions
Use 0 if reading the file fails. Fixes issue #13.
Diffstat (limited to 'src/Plugins/Monitors')
-rw-r--r--src/Plugins/Monitors/Batt.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs
index a472045..c276e6b 100644
--- a/src/Plugins/Monitors/Batt.hs
+++ b/src/Plugins/Monitors/Batt.hs
@@ -124,7 +124,7 @@ readBattery files =
(3600 * b / 1000000) -- wattseconds
(c / 1000000) -- volts
(if c > 0 then (d / c) else -1) -- amperes
- where grab = fmap (read . B.unpack) . B.readFile
+ where grab f = catch (fmap (read . B.unpack) $ B.readFile f) (\_ -> return 0)
readBatteries :: BattOpts -> [Files] -> IO Result
readBatteries opts bfs =