summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/MarqueePipeReader.hs
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2020-04-30 19:56:45 +0530
committerjao <jao@gnu.org>2020-04-30 16:45:31 +0100
commita705d021a8cfbb3b9bbfbec833302768d3ad459e (patch)
tree6d52eecacdc3d2536ac83a3c6e0ca8f3f0412bd2 /src/Xmobar/Plugins/MarqueePipeReader.hs
parentb0591c5e4c483aa47ef74ab25448c56cf6e3a82a (diff)
downloadxmobar-a705d021a8cfbb3b9bbfbec833302768d3ad459e.tar.gz
xmobar-a705d021a8cfbb3b9bbfbec833302768d3ad459e.tar.bz2
Refactor the usage of hGetLineSafe
hGetLineSafe is always hGetLine and hence we can directly use it.
Diffstat (limited to 'src/Xmobar/Plugins/MarqueePipeReader.hs')
-rw-r--r--src/Xmobar/Plugins/MarqueePipeReader.hs7
1 files changed, 3 insertions, 4 deletions
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 ()