on master help sign in
Better way to check readiness
fd4f5a9iko
src/Main.hs+4−4
unifiedsplit
@@ -52,13 +52,13 @@ colors = cycle [green, blue, magenta, cyan]
52
52
53writeOutput :: [String] -> String -> Handle -> IO Bool
53writeOutput :: [String] -> String -> Handle -> IO Bool
54writeOutput color prog h = do
54writeOutput color prog h = do
55− eof <- hIsEOF h
55+ inputAvailable <- hReady h
56− if eof
56+ if inputAvailable
57− then return False
57+ then do
58− else do
59 l <- hGetLine h
58 l <- hGetLine h
60 putStrLn $ formatWith color (prog <> " | ") <> l
59 putStrLn $ formatWith color (prog <> " | ") <> l
61 return True
60 return True
61+ else return False
62
62
63prettifyProcesses :: [String] -> [String]
63prettifyProcesses :: [String] -> [String]
64prettifyProcesses ps' =
64prettifyProcesses ps' =