From 6898804a114384ccc64e2038335d3fccc1d8fdd1 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 9 Mar 2013 21:38:14 +0000 Subject: [PATCH] ghc-7.6: fix src/server/PGFService.hs (use catch from base-4 Control.Exception) --- src/server/PGFService.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs index a353207f1..b934717e6 100644 --- a/src/server/PGFService.hs +++ b/src/server/PGFService.hs @@ -16,7 +16,7 @@ import qualified Codec.Binary.UTF8.String as UTF8 (decodeString) import qualified Data.ByteString.Lazy as BS import Control.Concurrent -import Control.Exception(evaluate) +import qualified Control.Exception as E import Control.Monad import Control.Monad.State(State,evalState,get,put) import Data.Char @@ -31,6 +31,9 @@ import System.IO import System.Directory(removeFile) import Fold(fold) -- transfer function for OpenMath LaTeX +catchIOE :: IO a -> (E.IOException -> IO a) -> IO a +catchIOE = E.catch + logFile :: FilePath logFile = "pgf-error.log" @@ -154,7 +157,7 @@ doExternal Nothing input = throwCGIError 400 "Unknown external command" ["Unknow doExternal (Just cmd) input = do liftIO $ logError ("External command: "++cmd) cmds <- liftIO $ (fmap lines $ readFile "external_services") - `catch` const (return []) + `catchIOE` const (return []) liftIO $ logError ("External services: "++show cmds) if cmd `elem` cmds then ok else err where @@ -357,7 +360,7 @@ pipeIt2graphviz format code = do -- fork off a thread to start consuming the output output <- BS.hGetContents outh outMVar <- newEmptyMVar - _ <- forkIO $ evaluate (BS.length output) >> putMVar outMVar () + _ <- forkIO $ E.evaluate (BS.length output) >> putMVar outMVar () -- now write and flush any input hPutStr inh code