Skip to content

Commit

Permalink
readRemaningChars check for end of file
Browse files Browse the repository at this point in the history
  • Loading branch information
lmbollen committed Oct 14, 2024
1 parent cd88b78 commit 9986600
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bittide-instances/src/Project/Handle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ waitForLine h expected =
-- Utility function that returns the remaining characters in a handle.
readRemainingChars :: Handle -> IO String
readRemainingChars h = do
rdy <- hReady h
if rdy
then do
c <- hGetChar h
(c :) <$> readRemainingChars h
else (pure "")
eof <- hIsEOF h
if eof then pure "" else do
rdy <- hReady h
if rdy
then do
c <- hGetChar h
(c :) <$> readRemainingChars h
else pure ""

0 comments on commit 9986600

Please sign in to comment.