aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-10-14 09:52:06 +0200
committerTom Smeding <tom@tomsmeding.com>2022-10-14 09:52:06 +0200
commita4636014ab24c810e491a5267042fd70e067c2c3 (patch)
treec21939bcd21472588bb6b2e9c896aa58be8ed71c /src
parent0bb8ae15a8ff487df00bc27db67ffa2e587f0eea (diff)
Flush stdout
Diffstat (limited to 'src')
-rw-r--r--src/IRC.hs6
-rw-r--r--src/Main.hs2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/IRC.hs b/src/IRC.hs
index 7e78c50..5a24909 100644
--- a/src/IRC.hs
+++ b/src/IRC.hs
@@ -4,11 +4,12 @@ import Control.Monad (forM_)
import Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString.Char8 as Char8
import Data.Char
+import Data.Text (Text)
+import qualified Data.Text as T
import Network.IRC.Client
-- import Network.IRC.Client.Events
import Lens.Micro
-import Data.Text (Text)
-import qualified Data.Text as T
+import System.IO (hFlush, stdout)
connectIRC :: (Text -> Bool) -> (Text -> IO [Text]) -> IO ()
@@ -49,6 +50,7 @@ noticeHandler = EventHandler
_ -> Nothing)
(\_ () -> do
liftIO $ putStrLn "Identification confirmation received, joining channel"
+ liftIO $ hFlush stdout
send $ Join (T.pack "#haskell"))
privmsgHandler :: (Text -> Bool) -> (Text -> IO [Text]) -> EventHandler s
diff --git a/src/Main.hs b/src/Main.hs
index 88a7259..9987b29 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -6,6 +6,7 @@ import Data.Text (Text)
import qualified Data.Text as T
import System.Environment (getArgs)
import System.Exit (die)
+import System.IO (hFlush, stdout)
import Ghci
import IRC
@@ -29,6 +30,7 @@ mainIRC = do
(\t -> T.take 2 t == T.pack "% ")
(\recvmsg -> do
putStrLn $ "Responding to " ++ T.unpack recvmsg
+ hFlush stdout
ghci <- takeMVar ghcivar
(ghci', msgs) <- runInGhci ghci (T.drop 2 recvmsg)
putMVar ghcivar ghci'