File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import Control.Exception (
2828 displayException ,
2929 throwIO ,
3030 )
31+ import qualified Control.Exception as X
3132import Control.Lens (
3233 (%=) ,
3334 (.=) ,
@@ -1241,15 +1242,11 @@ pipe cmd file args = do
12411242 }
12421243 runExternalProcess :: IORef ReplOutput -> String -> String -> IO ()
12431244 runExternalProcess pipeOut exec str = do
1244- (maybeInput, maybeOutput, _, _) <- createProcess' exec
1245- let outputFunc = maybe putStrLn hPutStr maybeInput
1246- outputFunc str
1247- case maybeOutput of
1248- Nothing ->
1249- hPutStrLn stderr " Error: couldn't access output handle."
1250- Just handle -> do
1251- output <- liftIO $ hGetContents handle
1252- modifyIORef pipeOut (appReplOut . AuxOut $ output)
1245+ (Just hIn, Just hOut, _, _) <- createProcess' exec
1246+ hPutStr hIn str
1247+ `catch` \ (X. SomeException e) -> hPutStrLn stderr (displayException e)
1248+ output <- liftIO $ hGetContents hOut
1249+ modifyIORef pipeOut (appReplOut . AuxOut $ output)
12531250 justPrint :: IORef ReplOutput -> String -> IO ()
12541251 justPrint outRef = modifyIORef outRef . appReplOut . AuxOut
12551252
You can’t perform that action at this time.
0 commit comments