Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/RawFilePath/Process.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ module RawFilePath.Process (
-- $configuring
ProcessConf,
proc,
setCwd,
setEnv,
setCloseFds,

-- *** Configuring process standard streams
StreamType,
Expand Down
36 changes: 36 additions & 0 deletions src/RawFilePath/Process/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ module RawFilePath.Process.Common (
setStdin,
setStdout,
setStderr,
setCwd,
setEnv,
setCloseFds,
UnknownStream,
untypeProcess,
untypeProcessStdin,
Expand Down Expand Up @@ -143,6 +146,39 @@ setStderr p newStderr = p{cfgStderr = newStderr}

infixl 4 `setStderr`

-- | Set the path to the working directory for the new process. 'Nothing' can be used to unset the property.
--
-- @since 1.1.2
setCwd
:: ProcessConf stdin stdout stderr
-> Maybe RawFilePath
-> ProcessConf stdin stdout stderr
setCwd p newCwd = p{cwd = newCwd}

infixl 4 `setCwd`

-- | Set the optional environment (otherwise inherit from the current process)
--
-- @since 1.1.2
setEnv
:: ProcessConf stdin stdout stderr
-> Maybe [(ByteString, ByteString)]
-> ProcessConf stdin stdout stderr
setEnv p newEnv = p{env = newEnv}

infixl 4 `setEnv`

-- | Control whether to close all file descriptors except stdin, stdout and stderr in the new process.
--
-- @since 1.1.2
setCloseFds
:: ProcessConf stdin stdout stderr
-> Bool
-> ProcessConf stdin stdout stderr
setCloseFds p newCloseFds = p{closeFds = newCloseFds}

infixl 4 `setCloseFds`

-- | The process type. The three type variables denote how its standard
-- streams were initialized.
data Process stdin stdout stderr = Process
Expand Down