turtle 1.5.10 → 1.5.11
raw patch · 5 files changed
+49/−12 lines, 5 filesdep ~stm
Dependency ranges changed: stm
Files
- CHANGELOG.md +9/−0
- src/Turtle/Bytes.hs +6/−6
- src/Turtle/Prelude.hs +4/−4
- src/Turtle/Tutorial.hs +28/−0
- turtle.cabal +2/−2
CHANGELOG.md view
@@ -1,3 +1,12 @@+1.5.11++* Don't forward broken pipe exceptions when using `inproc`+ * See: https://github.com/Gabriel439/Haskell-Turtle-Library/pull/321+* Increase upper bound on `stm`+ * See: https://github.com/Gabriel439/Haskell-Turtle-Library/pull/321+* Tutorial improvements:+ * See: https://github.com/Gabriel439/Haskell-Turtle-Library/pull/322+ 1.5.10 * Increase upper bound on `doctest` and `criterion`
src/Turtle/Bytes.hs view
@@ -519,15 +519,15 @@ mvar <- liftIO (MVar.newMVar False) let close handle = do MVar.modifyMVar_ mvar (\finalized -> do- Control.Monad.unless finalized (System.IO.hClose handle)+ Control.Monad.unless finalized (ignoreSIGPIPE (System.IO.hClose handle)) return True ) (hIn, hOut, ph) <- using (Managed.managed (Exception.bracket open (\(hIn, _, ph) -> close hIn >> Process.terminateProcess ph))) let feedIn :: (forall a. IO a -> IO a) -> IO () feedIn restore =- restore (sh (do+ restore (ignoreSIGPIPE (sh (do bytes <- s- liftIO (Data.ByteString.hPut hIn bytes) ) )+ liftIO (Data.ByteString.hPut hIn bytes) ) ) ) `Exception.finally` close hIn a <- using@@ -565,15 +565,15 @@ mvar <- liftIO (MVar.newMVar False) let close handle = do MVar.modifyMVar_ mvar (\finalized -> do- Control.Monad.unless finalized (System.IO.hClose handle)+ Control.Monad.unless finalized (ignoreSIGPIPE (System.IO.hClose handle)) return True ) (hIn, hOut, hErr, ph) <- using (Managed.managed (Exception.bracket open (\(hIn, _, _, ph) -> close hIn >> Process.terminateProcess ph))) let feedIn :: (forall a. IO a -> IO a) -> IO () feedIn restore =- restore (sh (do+ restore (ignoreSIGPIPE (sh (do bytes <- s- liftIO (Data.ByteString.hPut hIn bytes) ) )+ liftIO (Data.ByteString.hPut hIn bytes) ) ) ) `Exception.finally` close hIn queue <- liftIO TQueue.newTQueueIO
src/Turtle/Prelude.hs view
@@ -734,12 +734,12 @@ mvar <- liftIO (newMVar False) let close handle = do modifyMVar_ mvar (\finalized -> do- unless finalized (hClose handle)+ unless finalized (ignoreSIGPIPE (hClose handle)) return True ) (hIn, hOut, ph) <- using (managed (bracket open (\(hIn, _, ph) -> close hIn >> Process.terminateProcess ph))) let feedIn :: (forall a. IO a -> IO a) -> IO ()- feedIn restore = restore (outhandle hIn s) `finally` close hIn+ feedIn restore = restore (ignoreSIGPIPE (outhandle hIn s)) `finally` close hIn a <- using (managed (\k ->@@ -775,12 +775,12 @@ mvar <- liftIO (newMVar False) let close handle = do modifyMVar_ mvar (\finalized -> do- unless finalized (hClose handle)+ unless finalized (ignoreSIGPIPE (hClose handle)) return True ) (hIn, hOut, hErr, ph) <- using (managed (bracket open (\(hIn, _, _, ph) -> close hIn >> Process.terminateProcess ph))) let feedIn :: (forall a. IO a -> IO a) -> IO ()- feedIn restore = restore (outhandle hIn s) `finally` close hIn+ feedIn restore = restore (ignoreSIGPIPE (outhandle hIn s)) `finally` close hIn queue <- liftIO TQueue.newTQueueIO let forwardOut :: (forall a. IO a -> IO a) -> IO ()
src/Turtle/Tutorial.hs view
@@ -1053,6 +1053,34 @@ -- > (2,3) -- > (2,4) --+-- This is because `Shell` behaves like a list comprehension, running each+-- following command once for each element in the stream. This implies that+-- an `Shell` stream that produces 0 elements will short-circuit and prevent+-- subsequent commands from being run.+--+-- > -- This stream emits 0 elements but still has side effects+-- > inner :: Shell a+-- > inner = do+-- > x <- select [1, 2]+-- > y <- select [3, 4]+-- > liftIO (print (x, y))+-- > empty+-- > +-- > outer :: Shell ()+-- > outer = do+-- > inner+-- > liftIO (echo "This step will never run")+--+-- If you want to run a `Shell` stream just for its side effects, wrap the+-- `Shell` with `sh`. This ensures that you don't alter the surrounding+-- `Shell`'s control flow by unintentionally running subsequent commands zero+-- times or multiple times:+--+-- > outer :: Shell ()+-- > outer = do+-- > sh inner+-- > liftIO (echo "Now this step will exactly once")+-- -- This uses the `sh` utility instead of `view`. The only difference is that -- `sh` doesn't print any values (since `print` is doing that already): --
turtle.cabal view
@@ -1,5 +1,5 @@ Name: turtle-Version: 1.5.10+Version: 1.5.11 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3@@ -64,7 +64,7 @@ semigroups >= 0.5.0 && < 0.19, system-filepath >= 0.3.1 && < 0.5 , system-fileio >= 0.2.1 && < 0.4 ,- stm < 2.5 ,+ stm < 2.6 , temporary < 1.4 , text < 1.3 , time < 1.9 ,