Skip to content

Commit

Permalink
Restore Windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
UnkindPartition committed Mar 1, 2020
1 parent 09ae248 commit 5e4000f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions core/Test/Tasty/Runners/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ import Foreign.C (CInt)
#ifdef VERSION_clock
import qualified System.Clock as Clock
#endif

-- Install handlers only on UNIX
#define INSTALL_HANDLERS defined __UNIX__

#if INSTALL_HANDLERS
import System.Posix.Signals
import System.Mem.Weak (deRefWeak)
#endif

import Test.Tasty.Core (Time)

Expand Down Expand Up @@ -58,6 +64,7 @@ forceElements = foldr seq ()
-- older than 7.6.
installSignalHandlers :: IO ()
installSignalHandlers = do
#if INSTALL_HANDLERS
main_thread_id <- myThreadId
weak_tid <- mkWeakThreadId main_thread_id
forM_ [ sigABRT, sigBUS, sigFPE, sigHUP, sigILL, sigQUIT, sigSEGV,
Expand All @@ -69,6 +76,9 @@ installSignalHandlers = do
case m of
Nothing -> return ()
Just tid -> throwTo tid (toException $ SignalException sig)
#else
return ()
#endif

-- | This exception is thrown when the program receives a signal, assuming
-- 'installSignalHandlers' was called.
Expand Down
2 changes: 1 addition & 1 deletion quickcheck/tasty-quickcheck.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ test-suite test
, tasty-hunit
, pcre-light
ghc-options: -Wall
if (!impl(ghc >= 8.0))
if (!impl(ghc >= 8.0) || os(windows))
buildable: false

0 comments on commit 5e4000f

Please sign in to comment.