An effect for running child processes using the process library.
Instances2DispatchOf, StaticRep
type DispatchOf Process = 'Static 'WithSideEffectsDefined in effectful-2.3.0.0 · Effectful.Processdata StaticRep ProcessProcess
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
An effect for running child processes using the process library.
type DispatchOf Process = 'Static 'WithSideEffectsDefined in effectful-2.3.0.0 · Effectful.Processdata StaticRep ProcessProcessLifted createProcess.
Lifted createProcess_.
Construct a CreateProcess record for passing to createProcess, representing a command to be passed to the shell.
Construct a CreateProcess record for passing to createProcess, representing a raw command with arguments.
See RawCommand for precise semantics of the specified FilePath.
CreateProcesscmdspec :: CmdSpecExecutable & arguments, or shell command. If cwd is Nothing, relative paths are resolved with respect to the current working directory. If cwd is provided, it is implementation-dependent whether relative paths are resolved with respect to cwd or the current working directory, so absolute paths should be used to ensure portability.
cwd :: Maybe FilePathOptional path to the working directory for the new process
env :: Maybe [(String, String)]Optional environment (otherwise inherit from the current process)
std_in :: StdStreamHow to determine stdin
std_out :: StdStreamHow to determine stdout
std_err :: StdStreamHow to determine stderr XXX verify what happens with fds in nodejs child processes
close_fds :: BoolClose all file descriptors except stdin, stdout and stderr in the new process (on Windows, only works if std_in, std_out, and std_err are all Inherit). This implementation will call close on every fd from 3 to the maximum of open files, which can be slow for high maximum of open files.
create_group :: BoolCreate a new process group. On JavaScript this also creates a new session.
delegate_ctlc :: BoolDelegate control-C handling. Use this for interactive console processes to let them handle control-C themselves (see below for details).
detach_console :: BoolUse the windows DETACHED_PROCESS flag when creating the process; does nothing on other platforms.
create_new_console :: BoolUse the windows CREATE_NEW_CONSOLE flag when creating the process; does nothing on other platforms.
Default: False
new_session :: BoolUse posix setsid to start the new process in a new session; starts process in a new session on JavaScript; does nothing on other platforms.
child_group :: Maybe GroupIDUse posix setgid to set child process's group id; works for JavaScript when system running nodejs is posix. does nothing on other platforms.
Default: Nothing
child_user :: Maybe UserIDUse posix setuid to set child process's user id; works for JavaScript when system running nodejs is posix. does nothing on other platforms.
Default: Nothing
use_process_jobs :: BoolOn Windows systems this flag indicates that we should wait for the entire process tree to finish before unblocking. On POSIX systems this flag is ignored. See $exec-on-windows for details.
Default: False
Eq CreateProcessDefined in process-1.6.26.1 · System.Process.CommonShow CreateProcessDefined in process-1.6.26.1 · System.Process.CommonShellCommand StringA command line to execute using the shell
RawCommand FilePath [String]The name of an executable with a list of arguments
The FilePath argument names the executable, and is interpreted according to the platform's standard policy for searching for executables. Specifically:
on Unix systems the
execvp(3)
semantics is used, where if the executable filename does not
contain a slash (/) then the PATH environment variable is
searched for the executable.
on Windows systems the Win32 CreateProcess semantics is used.
Briefly: if the filename does not contain a path, then the
directory containing the parent executable is searched, followed
by the current directory, then some standard locations, and
finally the current PATH. An .exe extension is added if the
filename does not already have an extension. For full details
see the
documentation
for the Windows SearchPath API.
Windows does not have a mechanism for passing multiple arguments.
When using RawCommand on Windows, the command line is serialised
into a string, with arguments quoted separately. Command line
parsing is up individual programs, so the default behaviour may
not work for some programs. If you are not getting the desired
results, construct the command line yourself and use ShellCommand.
InheritInherit Handle from parent
UseHandle HandleUse the supplied Handle
CreatePipeCreate a new pipe. The returned
Handle will use the default encoding
and newline translation mode (just
like Handles created by openFile).
NoStreamClose the stream's file descriptor without
passing a Handle. On POSIX systems this may
lead to strange behavior in the child process
because attempting to read or write after the
file has been closed throws an error. This
should only be used with child processes that
don't use the file descriptor at all. If you
wish to ignore the child process's output you
should either create a pipe and drain it
manually or pass a Handle that writes to
/dev/null.
A handle to a process, which can be used to wait for termination of the process using waitForProcess.
None of the process-creation functions in this library wait for termination: they all return a ProcessHandle which may be used to wait for the process later.
On Windows a second wait method can be used to block for event completion. This requires two handles. A process job handle and a events handle to monitor.
Lifted callProcess.
Lifted callCommand.
Lifted spawnProcess.
Lifted spawnCommand.
Lifted readCreateProcess.
Lifted readProcess.
Lifted readCreateProcessWithExitCode.
Lifted readProcessWithExitCode.
Lifted withCreateProcess.
Lifted cleanupProcess.
Given a program p and arguments args,
showCommandForUser p args returns a string suitable for pasting
into /bin/sh (on Unix systems) or CMD.EXE (on Windows).
The platform specific type for a process identifier.
This is always an integral type. Width and signedness are platform specific.
Lifted getPid.
Lifted getCurrentPid.
Lifted waitForProcess.
Lifted getProcessExitCode.
Lifted terminateProcess.
Lifted interruptProcessGroupOf.
Lifted createPipe.
Lifted createPipeFd.