FIX file flushing errors

This commit is contained in:
Nathan Dwarshuis 2023-01-04 23:47:21 -05:00
parent 3cc7e02416
commit 2712ebdf37
2 changed files with 3 additions and 1 deletions

View File

@ -140,7 +140,7 @@ runXIO logfile x = withLogFile logfile $ \h -> hRunXIO True h x
withLogFile :: MonadUnliftIO m => FilePath -> (Handle -> m a) -> m a withLogFile :: MonadUnliftIO m => FilePath -> (Handle -> m a) -> m a
withLogFile logfile f = do withLogFile logfile f = do
p <- (</> logfile) . dataDir <$> liftIO getDirectories p <- (</> logfile) . dataDir <$> liftIO getDirectories
catchIO (withFile p AppendMode f) $ \e -> do catchIO (withBinaryFile p AppendMode f) $ \e -> do
liftIO $ print e liftIO $ print e
liftIO $ putStrLn "could not open log file, falling back to stderr" liftIO $ putStrLn "could not open log file, falling back to stderr"
f stderr f stderr

View File

@ -91,6 +91,8 @@ startAdapter is cs cb cl = do
forM_ devices $ \d -> addAndInitDevice d forM_ devices $ \d -> addAndInitDevice d
-- after setting things up, show the icon based on the initialized state -- after setting things up, show the icon based on the initialized state
dpy dpy
-- keep file descriptors open in callback threads
forever $ threadDelay 1000000
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Icon Display -- Icon Display