Also catch exceptions thrown in IO

This commit is contained in:
Daniel Gröber
2015-09-01 04:14:15 +02:00
parent 99ed6a94f1
commit 2af1da960b
3 changed files with 16 additions and 12 deletions

View File

@@ -62,8 +62,8 @@ module Language.Haskell.GhcMod (
, gmErrStr
, gmPutStrLn
, gmErrStrLn
, gmUnsafePutStrLn
, gmUnsafeErrStrLn
, gmUnsafePutStr
, gmUnsafeErrStr
-- * FileMapping
, loadMappedFile
, loadMappedFileSource

View File

@@ -23,8 +23,8 @@ module Language.Haskell.GhcMod.Output (
, gmPutStrLn
, gmErrStrLn
, gmReadProcess
, gmUnsafePutStrLn
, gmUnsafeErrStrLn
, gmUnsafePutStr
, gmUnsafeErrStr
, gmUnsafeReadProcess
, stdoutGateway
) where
@@ -109,10 +109,10 @@ gmErrStr str = do
putErr $ toGmLines str
-- | Only use these when you're sure there are no other writers on stdout
gmUnsafePutStrLn, gmUnsafeErrStrLn
gmUnsafePutStr, gmUnsafeErrStr
:: MonadIO m => OutputOpts -> String -> m ()
gmUnsafePutStrLn oopts = (fst $ outputFns' oopts GmOutputStdio) . toGmLines
gmUnsafeErrStrLn oopts = (snd $ outputFns' oopts GmOutputStdio) . toGmLines
gmUnsafePutStr oopts = (fst $ outputFns' oopts GmOutputStdio) . toGmLines
gmUnsafeErrStr oopts = (snd $ outputFns' oopts GmOutputStdio) . toGmLines
gmUnsafeReadProcess :: OutputOpts -> FilePath -> [String] -> String -> IO String
gmUnsafeReadProcess oopts =