From 68f9d227eadc0663bf5a9ce2ca1d25e91e9d20ce Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Mon, 23 Jun 2008 19:13:32 +0000 Subject: Follow extensible exception changes --- testsuite/timeout/timeout.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'testsuite/timeout') diff --git a/testsuite/timeout/timeout.hs b/testsuite/timeout/timeout.hs index 74ba8f4a00..3a32280cf2 100644 --- a/testsuite/timeout/timeout.hs +++ b/testsuite/timeout/timeout.hs @@ -2,7 +2,8 @@ import Control.Concurrent (forkIO, threadDelay) import Control.Concurrent.MVar (putMVar, takeMVar, newEmptyMVar) -import Control.Exception (try) +import Control.Exception (ignoreExceptions, catchAny, throw, catch) +import Control.OldException (Exception(ExitException), catch) import Data.Maybe (isNothing) import System.Cmd (system) import System.Environment (getArgs) @@ -45,12 +46,12 @@ run secs cmd = do forkIO (do threadDelay (secs * 1000000) putMVar m Nothing ) - forkIO (do try (do pid <- systemSession cmd + forkIO (ignoreExceptions (do + pid <- systemSession cmd ph <- mkProcessHandle pid putMVar mp (pid,ph) r <- waitForProcess ph - putMVar m (Just r)) - return ()) + putMVar m (Just r))) (pid,ph) <- takeMVar mp r <- takeMVar m @@ -73,7 +74,7 @@ systemSession cmd = -- more threads. killProcess pid ph = do - try (signalProcessGroup sigTERM pid) + ignoreExceptions (signalProcessGroup sigTERM pid) checkReallyDead 10 where checkReallyDead 0 = hPutStrLn stderr "checkReallyDead: Giving up" @@ -81,7 +82,7 @@ killProcess pid ph = do do threadDelay (3*100000) -- 3/10 sec m <- getProcessExitCode ph when (isNothing m) $ do - try (signalProcessGroup sigKILL pid) + ignoreExceptions (signalProcessGroup sigKILL pid) checkReallyDead n #else -- cgit v1.2.1