From a705d021a8cfbb3b9bbfbec833302768d3ad459e Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Thu, 30 Apr 2020 19:56:45 +0530 Subject: Refactor the usage of hGetLineSafe hGetLineSafe is always hGetLine and hence we can directly use it. --- src/Xmobar/Plugins/MarqueePipeReader.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Xmobar/Plugins/MarqueePipeReader.hs') diff --git a/src/Xmobar/Plugins/MarqueePipeReader.hs b/src/Xmobar/Plugins/MarqueePipeReader.hs index 084331b..f1fdee0 100644 --- a/src/Xmobar/Plugins/MarqueePipeReader.hs +++ b/src/Xmobar/Plugins/MarqueePipeReader.hs @@ -14,10 +14,9 @@ module Xmobar.Plugins.MarqueePipeReader(MarqueePipeReader(..)) where -import System.IO (openFile, IOMode(ReadWriteMode), Handle) +import System.IO (openFile, IOMode(ReadWriteMode), Handle, hGetLine) import Xmobar.System.Environment import Xmobar.Run.Exec(Exec(alias, start), tenthSeconds) -import Xmobar.System.Utils(hGetLineSafe) import System.Posix.Files (getFileStatus, isNamedPipe) import Control.Concurrent(forkIO, threadDelay) import Control.Concurrent.STM (TChan, atomically, writeTChan, tryReadTChan, newTChan) @@ -39,7 +38,7 @@ instance Exec MarqueePipeReader where unless (null def) (cb def) checkPipe pipe h <- openFile pipe ReadWriteMode - line <- hGetLineSafe h + line <- hGetLine h chan <- atomically newTChan forkIO $ writer (toInfTxt line sep) sep len rate chan cb forever $ pipeToChan h chan @@ -50,7 +49,7 @@ instance Exec MarqueePipeReader where pipeToChan :: Handle -> TChan String -> IO () pipeToChan h chan = do - line <- hGetLineSafe h + line <- hGetLine h atomically $ writeTChan chan line writer :: String -> Separator -> Length -> Rate -> TChan String -> (String -> IO ()) -> IO () -- cgit v1.2.3