1
+ {-# LANGUAGE CPP #-}
2
+
1
3
module Main where
2
4
3
5
@@ -10,8 +12,6 @@ import PostgREST.DbStructure
10
12
import PostgREST.Error (PgError , pgErrResponse )
11
13
import PostgREST.Middleware
12
14
13
- import Control.Concurrent (myThreadId )
14
- import Control.Exception.Base (throwTo , AsyncException (.. ))
15
15
import Control.Monad (unless , void )
16
16
import Control.Monad.IO.Class (liftIO )
17
17
import Data.Aeson (encode )
@@ -28,9 +28,14 @@ import Network.Wai.Middleware.RequestLogger (logStdout)
28
28
import System.IO (BufferMode (.. ),
29
29
hSetBuffering , stderr ,
30
30
stdin , stdout )
31
- import System.Posix.Signals
32
31
import Web.JWT (secret )
33
32
33
+ #ifndef mingw32_HOST_OS
34
+ import System.Posix.Signals
35
+ import Control.Concurrent (myThreadId )
36
+ import Control.Exception.Base (throwTo , AsyncException (.. ))
37
+ #endif
38
+
34
39
isServerVersionSupported :: H. Session P. Postgres IO Bool
35
40
isServerVersionSupported = do
36
41
Identity (row :: Text ) <- H. tx Nothing $ H. singleEx [H. stmt |SHOW server_version_num|]
@@ -72,11 +77,13 @@ main = do
72
77
<> show minimumPgVersion)
73
78
) supportedOrError
74
79
80
+ #ifndef mingw32_HOST_OS
75
81
tid <- myThreadId
76
82
void $ installHandler keyboardSignal (Catch $ do
77
83
H. releasePool pool
78
84
throwTo tid UserInterrupt
79
85
) Nothing
86
+ #endif
80
87
81
88
let txSettings = Just (H. ReadCommitted , Just True )
82
89
dbOrError <- H. session pool $ H. tx txSettings $ getDbStructure (cs $ configSchema conf)
0 commit comments