git.iko.soy/distributed-process
on master help sign in
Prevent testBreakConnection from failing.
9f0d4f9Facundo Domínguez
distributed-process-tests/tests/runTCP.hs+3−2
@@ -15,6 +15,7 @@ import Network.Transport.TCP
15import Test.Framework (defaultMainWithArgs)
15import Test.Framework (defaultMainWithArgs)
16
16
17import Control.Concurrent (threadDelay)
17import Control.Concurrent (threadDelay)
18+import Control.Exception (IOException, try)
18import System.Environment (getArgs)
19import System.Environment (getArgs)
19import System.IO
20import System.IO
20
21
@@ -28,8 +29,8 @@ main = do
28 ts <- tests TestTransport
29 ts <- tests TestTransport
29 { testTransport = transport
30 { testTransport = transport
30 , testBreakConnection = \addr1 addr2 -> do
31 , testBreakConnection = \addr1 addr2 -> do
31− sock <- socketBetween internals addr1 addr2
32+ esock <- try $ socketBetween internals addr1 addr2
32− sClose sock
33+ either (\e -> const (return ()) (e :: IOException)) sClose esock
33 threadDelay 10000
34 threadDelay 10000
34 }
35 }
35 args <- getArgs
36 args <- getArgs