process-extras 0.3.0.1 → 0.3.1
raw patch · 3 files changed
+12/−5 lines, 3 filesdep ~deepseq
Dependency ranges changed: deepseq
Files
- README.md +2/−2
- process-extras.cabal +1/−1
- src/System/Process/Common.hs +9/−2
README.md view
@@ -4,6 +4,6 @@ # Contributing -This project is available on [GitHub](https://github.com/davidlazar/process-extras) and [Bitbucket](https://bitbucket.org/davidlazar/process-extras/). You may contribute changes using either.+This project is available on [GitHub](https://github.com/seereason/process-extras). You may contribute changes there. -Please report bugs and feature requests using the [GitHub issue tracker](https://github.com/davidlazar/process-extras/issues).+Please report bugs and feature requests using the [GitHub issue tracker](https://github.com/ddssff/process-extras/issues).
process-extras.cabal view
@@ -1,5 +1,5 @@ Name: process-extras-Version: 0.3.0.1+Version: 0.3.1 Synopsis: Process extras Description: Extra functionality for the Process library <http://hackage.haskell.org/package/process>.
src/System/Process/Common.hs view
@@ -4,7 +4,7 @@ import Control.Applicative (pure, (<$>), (<*>)) import Control.Concurrent-import Control.Exception as E (SomeException, onException, catch, mask, throw)+import Control.Exception as E (SomeException, onException, catch, mask, throw, try) import Control.Monad import Data.ListLike (null) import Data.ListLike.IO (ListLikeIO, hGetContents, hPutStr)@@ -76,7 +76,7 @@ waitErr <- forkWait $ errf <$> (hGetContents errh >>= forceOutput) -- now write and flush any input- unless (null input) $ do hPutStr inh input; hFlush inh+ unless (null input) $ do ignoreResourceVanished (hPutStr inh input); hFlush inh hClose inh -- done with stdin -- wait on the output@@ -90,6 +90,13 @@ ex <- codef <$> waitForProcess pid return $ out <> err <> ex++ignoreResourceVanished :: IO () -> IO ()+ignoreResourceVanished action =+ try action >>= either ignoreResourceVanished' return+ where+ ignoreResourceVanished' e | ioe_type e == ResourceVanished = return ()+ ignoreResourceVanished' e = throw e -- | Like readCreateProcess, but the output is read lazily. readCreateProcessLazy :: (ProcessOutput a b, ListLikeProcessIO a c) => CreateProcess -> a -> IO b