From f512034c339ce24fbcac829024bd35b676347d60 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 8 Nov 2011 21:48:19 +0100 Subject: Battery: last vestiges of lazy io removed --- src/Plugins/Monitors/Batt.hs | 4 +--- 1 file changed, 1 insertion(+), 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 -- cgit v1.2.3