From 2712ebdf37908a341c9149c8e92b2a451b4cac11 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 4 Jan 2023 23:47:21 -0500 Subject: [PATCH] FIX file flushing errors --- lib/Data/Internal/XIO.hs | 2 +- lib/Xmobar/Plugins/Bluetooth.hs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Data/Internal/XIO.hs b/lib/Data/Internal/XIO.hs index b516e6a..d35d0af 100644 --- a/lib/Data/Internal/XIO.hs +++ b/lib/Data/Internal/XIO.hs @@ -140,7 +140,7 @@ runXIO logfile x = withLogFile logfile $ \h -> hRunXIO True h x withLogFile :: MonadUnliftIO m => FilePath -> (Handle -> m a) -> m a withLogFile logfile f = do p <- ( logfile) . dataDir <$> liftIO getDirectories - catchIO (withFile p AppendMode f) $ \e -> do + catchIO (withBinaryFile p AppendMode f) $ \e -> do liftIO $ print e liftIO $ putStrLn "could not open log file, falling back to stderr" f stderr diff --git a/lib/Xmobar/Plugins/Bluetooth.hs b/lib/Xmobar/Plugins/Bluetooth.hs index 3b396e0..2734bcb 100644 --- a/lib/Xmobar/Plugins/Bluetooth.hs +++ b/lib/Xmobar/Plugins/Bluetooth.hs @@ -91,6 +91,8 @@ startAdapter is cs cb cl = do forM_ devices $ \d -> addAndInitDevice d -- after setting things up, show the icon based on the initialized state dpy + -- keep file descriptors open in callback threads + forever $ threadDelay 1000000 -------------------------------------------------------------------------------- -- Icon Display