summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2011-11-08 21:48:19 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2011-11-08 21:48:19 +0100
commitf512034c339ce24fbcac829024bd35b676347d60 (patch)
tree6592f22c82421dadd886dc67c526c1a0bbbfb9f3 /src
parentb08c8830e1db1942dd0a1b00fea4e195e4c75a14 (diff)
downloadxmobar-f512034c339ce24fbcac829024bd35b676347d60.tar.gz
xmobar-f512034c339ce24fbcac829024bd35b676347d60.tar.bz2
Battery: last vestiges of lazy io removed
Diffstat (limited to 'src')
-rw-r--r--src/Plugins/Monitors/Batt.hs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs
index ccb75eb..d1403e6 100644
--- a/src/Plugins/Monitors/Batt.hs
+++ b/src/Plugins/Monitors/Batt.hs
@@ -24,8 +24,6 @@ import System.IO (IOMode(ReadMode), hGetLine, withFile)
import System.Posix.Files (fileExist)
import System.Console.GetOpt
-import qualified Data.ByteString.Lazy.Char8 as B
-
data BattOpts = BattOpts
{ onString :: String
, offString :: String
@@ -130,7 +128,7 @@ readBattery files =
(3600 * b / 1000000) -- wattseconds
(c / 1000000) -- volts
(if c > 0 then (d / c) else -1) -- amperes
- where grab f = handle onError (fmap (read . B.unpack) $ B.readFile f)
+ where grab f = handle onError $ withFile f ReadMode (fmap read . hGetLine)
onError = const (return (-1)) :: SomeException -> IO Float
readBatteries :: BattOpts -> [Files] -> IO Result