packages feed

typed-process 0.2.0.0 → 0.2.1.0

raw patch · 3 files changed

+78/−3 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ System.Process.Typed: readProcessStderr :: MonadIO m => ProcessConfig stdin stderrIgnored stderr -> m (ExitCode, ByteString)
+ System.Process.Typed: readProcessStderr_ :: MonadIO m => ProcessConfig stdin stderrIgnored stderr -> m ByteString
+ System.Process.Typed: readProcessStdout :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m (ExitCode, ByteString)
+ System.Process.Typed: readProcessStdout_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m ByteString
- System.Process.Typed: byteStringInput :: ByteString -> StreamSpec STInput ()
+ System.Process.Typed: byteStringInput :: ByteString -> StreamSpec 'STInput ()
- System.Process.Typed: byteStringOutput :: StreamSpec STOutput (STM ByteString)
+ System.Process.Typed: byteStringOutput :: StreamSpec 'STOutput (STM ByteString)
- System.Process.Typed: setStderr :: StreamSpec STOutput stderr -> ProcessConfig stdin stdout stderr0 -> ProcessConfig stdin stdout stderr
+ System.Process.Typed: setStderr :: StreamSpec 'STOutput stderr -> ProcessConfig stdin stdout stderr0 -> ProcessConfig stdin stdout stderr
- System.Process.Typed: setStdin :: StreamSpec STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr
+ System.Process.Typed: setStdin :: StreamSpec 'STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr
- System.Process.Typed: setStdout :: StreamSpec STOutput stdout -> ProcessConfig stdin stdout0 stderr -> ProcessConfig stdin stdout stderr
+ System.Process.Typed: setStdout :: StreamSpec 'STOutput stdout -> ProcessConfig stdin stdout0 stderr -> ProcessConfig stdin stdout stderr

Files

ChangeLog.md view
@@ -1,3 +1,8 @@+## 0.2.1.0++* Add `readProcessStdout`, `readProcessStdout_`, `readProcessStderr`, and `readProcessStderr_`+* Do not show modified environment information in exceptions+ ## 0.2.0.0  * Remove dependency on `conduit` and `conduit-extra`. Relevant code added to
src/System/Process/Typed.hs view
@@ -65,6 +65,10 @@     , readProcess_     , runProcess     , runProcess_+    , readProcessStdout+    , readProcessStdout_+    , readProcessStderr+    , readProcessStderr_        -- * Interact with a process @@ -691,6 +695,70 @@     pc' = setStdout byteStringOutput         $ setStderr byteStringOutput pc +-- | Same as 'readProcess', but only read the stdout of the process. Original settings for stderr remain.+--+-- @since 0.2.1.0+readProcessStdout+  :: MonadIO m+  => ProcessConfig stdin stdoutIgnored stderr+  -> m (ExitCode, L.ByteString)+readProcessStdout pc =+    liftIO $ withProcess pc' $ \p -> atomically $ (,)+        <$> waitExitCodeSTM p+        <*> getStdout p+  where+    pc' = setStdout byteStringOutput pc++-- | Same as 'readProcessStdout', but instead of returning the+-- 'ExitCode', checks it with 'checkExitCode'.+--+-- @since 0.2.1.0+readProcessStdout_+  :: MonadIO m+  => ProcessConfig stdin stdoutIgnored stderr+  -> m L.ByteString+readProcessStdout_ pc =+    liftIO $ withProcess pc' $ \p -> atomically $ do+        stdout <- getStdout p+        checkExitCodeSTM p `catchSTM` \ece -> throwSTM ece+            { eceStdout = stdout+            }+        return stdout+  where+    pc' = setStdout byteStringOutput pc++-- | Same as 'readProcess', but only read the stderr of the process. Original settings for stderr remain.+--+-- @since 0.2.1.0+readProcessStderr+  :: MonadIO m+  => ProcessConfig stdin stderrIgnored stderr+  -> m (ExitCode, L.ByteString)+readProcessStderr pc =+    liftIO $ withProcess pc' $ \p -> atomically $ (,)+        <$> waitExitCodeSTM p+        <*> getStderr p+  where+    pc' = setStderr byteStringOutput pc++-- | Same as 'readProcessStderr', but instead of returning the+-- 'ExitCode', checks it with 'checkExitCode'.+--+-- @since 0.2.1.0+readProcessStderr_+  :: MonadIO m+  => ProcessConfig stdin stderrIgnored stderr+  -> m L.ByteString+readProcessStderr_ pc =+    liftIO $ withProcess pc' $ \p -> atomically $ do+        stderr <- getStderr p+        checkExitCodeSTM p `catchSTM` \ece -> throwSTM ece+            { eceStderr = stderr+            }+        return stderr+  where+    pc' = setStderr byteStringOutput pc+ -- | Run the given process, wait for it to exit, and returns its -- 'ExitCode'. --@@ -798,7 +866,9 @@         [ "Received "         , show (eceExitCode ece)         , " when running\n"-        , show (eceProcessConfig ece)+        -- Too much output for an exception if we show the modified+        -- environment, so hide it+        , show (eceProcessConfig ece) { pcEnv = Nothing }         , if L.null (eceStdout ece)             then ""             else "Standard output:\n\n" ++ L8.unpack (eceStdout ece)
typed-process.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 560e972d4c4e48105953a0dfdad3211ec5fd390979dba3f10e57fa6b2407aea7+-- hash: e72374c0c785376b03398fc434d91290fe62139cf33b5a9645e9ab494318f219  name:           typed-process-version:        0.2.0.0+version:        0.2.1.0 synopsis:       Run external processes, with strong typing of streams description:    Please see the tutorial at <https://haskell-lang.org/library/typed-process> category:       System