Make ormolu happy

This commit is contained in:
Bodigrim 2022-06-06 22:19:15 +01:00
parent 8960d8cc02
commit b70e637ac0
2 changed files with 14 additions and 10 deletions

View File

@ -107,11 +107,7 @@ processWorker runSettings eventChan outputChan = do
waitForEvent :: Chan FS.Event -> IO RestartEvent
waitForEvent eventChan = do
isTerminal <- hIsTerminalDevice stdin
#ifdef MIN_VERSION_Win32
isMinTTY <- withHandleToHANDLE stdin isMinTTYHandle
#else
let isMinTTY = False
#endif
isMinTTY <- getMinTTY
if isTerminal || isMinTTY
then do
hSetBuffering stdin NoBuffering
@ -120,6 +116,12 @@ waitForEvent eventChan = do
(StdinEvent <$> hGetChar stdin)
(FSEvent <$> readChan eventChan)
else FSEvent <$> readChan eventChan
where
#ifdef MIN_VERSION_Win32
getMinTTY = withHandleToHANDLE stdin isMinTTYHandle
#else
getMinTTY = pure False
#endif
data Output
= OutputEvent !RestartEvent

View File

@ -29,16 +29,18 @@ import UnliftIO
getStdinFiles :: Path Abs Dir -> IO (Maybe (Set FilePath))
getStdinFiles here = do
isTerminal <- hIsTerminalDevice stdin
#ifdef MIN_VERSION_Win32
isMinTTY <- withHandleToHANDLE stdin isMinTTYHandle
#else
let isMinTTY = False
#endif
isMinTTY <- getMinTTY
if isTerminal || isMinTTY
then pure Nothing
else
(Just <$> handleFileSet here stdin)
`catch` (\(_ :: IOException) -> pure Nothing)
where
#ifdef MIN_VERSION_Win32
getMinTTY = withHandleToHANDLE stdin isMinTTYHandle
#else
getMinTTY = pure False
#endif
mkEventFilter :: Path Abs Dir -> Maybe (Set FilePath) -> FilterSettings -> IO (FS.Event -> Bool)
mkEventFilter here mStdinFiles FilterSettings {..} = do