From c5acb412239617475ffb975a0f0728d36bb2c2dc Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Sat, 25 Jan 2025 15:09:49 -0500 Subject: [PATCH] threadWaitRead does not work on windows. A fix was introduced in 243f01b5aea2aebf188b86bb1f51c2555b9d4db0 The conditional was removed by mistake in 769ca47f4da421b75b97a87102613b406d46d0d3 To fix the regression the conditional will be reintroduced. --- src/Hasql/Notifications.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Hasql/Notifications.hs b/src/Hasql/Notifications.hs index dd75d2e..50720e6 100644 --- a/src/Hasql/Notifications.hs +++ b/src/Hasql/Notifications.hs @@ -17,8 +17,11 @@ module Hasql.Notifications FatalError (..), ) where - -import Control.Concurrent (threadDelay, threadWaitRead) +#if defined(mingw32_HOST_OS) +import Control.Concurrent ( threadDelay ) +#else +import Control.Concurrent (threadWaitRead, threadDelay) +#endif import Control.Exception (Exception, throw) import Control.Monad (forever, unless, void, when) import Data.ByteString.Char8 (ByteString) @@ -190,9 +193,13 @@ waitForNotifications sendNotification con = mfd <- PQ.socket pqCon case mfd of Nothing -> void $ threadDelay 1000000 +#if defined(mingw32_HOST_OS) + Just _ -> do + void $ threadDelay 1000000 +#else Just fd -> do void $ threadWaitRead fd - +#endif result <- PQ.consumeInput pqCon unless result $ do mError <- PQ.errorMessage pqCon