process-extras 0.1.2 → 0.1.3
raw patch · 4 files changed
+9/−13 lines, 4 files
Files
- process-extras.cabal +1/−1
- src/System/Process/ByteString.hs +1/−0
- src/System/Process/ByteString/Lazy.hs +6/−12
- src/System/Process/Text.hs +1/−0
process-extras.cabal view
@@ -1,5 +1,5 @@ Name: process-extras-Version: 0.1.2+Version: 0.1.3 Synopsis: Process extras Description: Extra functionality for the Process library <http://hackage.haskell.org/package/process>.
src/System/Process/ByteString.hs view
@@ -43,6 +43,7 @@ takeMVar outMVar takeMVar outMVar hClose outh+ hClose errh -- wait on the process ex <- waitForProcess pid
src/System/Process/ByteString/Lazy.hs view
@@ -1,6 +1,7 @@ module System.Process.ByteString.Lazy where import Control.Concurrent+import qualified Control.Exception as C import Control.Monad import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as B@@ -20,20 +21,14 @@ std_out = CreatePipe, std_err = CreatePipe } outMVar <- newEmptyMVar- outM <- newEmptyMVar- errM <- newEmptyMVar -- fork off a thread to start consuming stdout- _ <- forkIO $ do- out <- B.hGetContents outh- putMVar outM out- putMVar outMVar ()+ out <- B.hGetContents outh+ _ <- forkIO $ C.evaluate (B.length out) >> putMVar outMVar () -- fork off a thread to start consuming stderr- _ <- forkIO $ do- err <- B.hGetContents errh- putMVar errM err- putMVar outMVar ()+ err <- B.hGetContents errh+ _ <- forkIO $ C.evaluate (B.length err) >> putMVar outMVar () -- now write and flush any input when (not (B.null input)) $ do B.hPutStr inh input; hFlush inh@@ -43,10 +38,9 @@ takeMVar outMVar takeMVar outMVar hClose outh+ hClose errh -- wait on the process ex <- waitForProcess pid- out <- readMVar outM- err <- readMVar errM return (ex, out, err)
src/System/Process/Text.hs view
@@ -44,6 +44,7 @@ takeMVar outMVar takeMVar outMVar hClose outh+ hClose errh -- wait on the process ex <- waitForProcess pid