conduit-extra 1.3.4 → 1.3.5
raw patch · 3 files changed
+21/−23 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Conduit.Process.Typed: createSinkClose :: MonadIO m => StreamSpec 'STInput (ConduitM ByteString o m ())
Files
- ChangeLog.md +4/−0
- Data/Conduit/Process/Typed.hs +16/−22
- conduit-extra.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for conduit-extra +## 1.3.5++* Add `createSinkClose`+ ## 1.3.4 * Use `MonadUnliftIO`-generalized versions of `withProcess`-style functions now provided by `typed-process`
Data/Conduit/Process/Typed.hs view
@@ -5,6 +5,7 @@ module Data.Conduit.Process.Typed ( -- * Conduit specific stuff createSink+ , createSinkClose , createSource -- * Running a process with logging , withLoggedProcess_@@ -23,9 +24,13 @@ import Data.IORef (IORef, newIORef, readIORef, modifyIORef) import Control.Exception (throwIO, catch) import Control.Concurrent.Async (concurrently)-import System.IO (hSetBuffering, BufferMode (NoBuffering))+import System.IO (hSetBuffering, BufferMode (NoBuffering), hClose) --- | Provide input to a process by writing to a conduit.+-- | Provide input to a process by writing to a conduit. The sink provided here+-- will leave the pipe to the child open after the stream ends. This allows the+-- sink to be used multiple times, but may result in surprising behavior. You+-- may prefer 'createSinkClose', see+-- <https://github.com/snoyberg/conduit/issues/434>. -- -- @since 1.2.1 createSink :: MonadIO m => StreamSpec 'STInput (ConduitM S.ByteString o m ())@@ -33,6 +38,15 @@ (\h -> liftIO (hSetBuffering h NoBuffering) >> CB.sinkHandle h) `fmap` createPipe +-- | Like 'createSink', but closes the pipe to the child process as soon as it+-- runs out of data.+--+-- @since 1.3.5+createSinkClose :: MonadIO m => StreamSpec 'STInput (ConduitM S.ByteString o m ())+createSinkClose =+ (\h -> liftIO (hSetBuffering h NoBuffering) >> CB.sinkHandle h >> liftIO (hClose h))+ `fmap` createPipe+ -- | Read output from a process by read from a conduit. -- -- @since 1.2.1@@ -55,26 +69,6 @@ .| CL.iterM (\bs -> liftIO $ modifyIORef ref (. (bs:)))) ) `fmap` createPipe---- | Same as 'P.withProcess', but generalized to 'MonadUnliftIO'.------ @since 1.2.1-withProcess- :: MonadUnliftIO m- => ProcessConfig stdin stdout stderr- -> (Process stdin stdout stderr -> m a)- -> m a-withProcess pc f = withRunInIO $ \run -> P.withProcess pc (run . f)---- | Same as 'P.withProcess_', but generalized to 'MonadUnliftIO'.------ @since 1.2.1-withProcess_- :: MonadUnliftIO m- => ProcessConfig stdin stdout stderr- -> (Process stdin stdout stderr -> m a)- -> m a-withProcess_ pc f = withRunInIO $ \run -> P.withProcess_ pc (run . f) -- | Run a process, throwing an exception on a failure exit code. This -- will store all output from stdout and stderr in memory for better
conduit-extra.cabal view
@@ -1,5 +1,5 @@ Name: conduit-extra-Version: 1.3.4+Version: 1.3.5 Synopsis: Batteries included conduit: adapters for common libraries. Description: The conduit package itself maintains relative small dependencies. The purpose of this package is to collect commonly used utility functions wrapping other library dependencies, without depending on heavier-weight dependencies. The basic idea is that this package should only depend on haskell-platform packages and conduit.