From c4505b1bf2fe8e3d9a55b266e19137d467dd5f61 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 15 Aug 2024 11:05:04 -0700 Subject: [PATCH] Add `getProcessConfig` This enables third-parties to construct their own `ExitCodeException`s from `Process` values. --- src/System/Process/Typed.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/System/Process/Typed.hs b/src/System/Process/Typed.hs index abb0303..5978d35 100644 --- a/src/System/Process/Typed.hs +++ b/src/System/Process/Typed.hs @@ -664,6 +664,18 @@ getStdout = pStdout getStderr :: Process stdin stdout stderr -> stderr getStderr = pStderr +-- | Get a process's configuration. +-- +-- This is useful for constructing 'ExitCodeException's. +-- +-- Note that the stdin, stdout, and stderr streams are stored in the 'Process', +-- not the 'ProcessConfig', so the returned 'ProcessConfig' will always have +-- empty stdin, stdout, and stderr values. +-- +-- @since 0.2.12.0 +getProcessConfig :: Process stdin stdout stderr -> ProcessConfig () () () +getProcessConfig = pConfig + -- | Take 'System.Process.ProcessHandle' out of the 'Process'. -- This method is needed in cases one need to use low level functions -- from the @process@ package. Use cases for this method are: