HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleprocess-extras-0.7.4Haskell2010

System.Process.ListLike

Re-export all symbols and instances of the process-extras package. Adds the Chunk type with a ProcessOutput instance, and a collectOutput function to turn a list of chunks into any instance of ProcessOutput, such as (ExitCode, String, String). This means you can have readCreateProcess output a list of Chunk, operate on it to do progress reporting, and finally convert it to the type that readProcessWithExitCode woud have returned.

  • 3 types
  • 4 classes
  • 14 values

Classes for process IO monad, output type, and creation type

4 declarations
classclass ListLikeIO text char => ListLikeProcessIO text char where
#

Process IO is based on the ListLikeIO class from the ListLike package

Methods

Instances7ListLikeProcessIO, …
classclass (IsString text, Monoid text, ListLike text char) => ProcessText text char
#
Instances5ProcessText
classclass Monoid result => ProcessResult text result | result -> text where
#

Methods

Instances3ProcessResult
classclass ProcessMaker a where
#
Instances2ProcessMaker

The generalized process runners

5 declarations
valuereadProcessWithExitCode
  1. :: ListLikeProcessIO text char
  2. => FilePath

    command to run

  3. -> [String]

    any arguments

  4. -> text

    standard input

  5. -> IO (ExitCode, text, text)

    exitcode, stdout, stderr

#

Like readProcessWithExitCode, but with generalized input and output type. Aside from the usual text-like types, the output can be a list of Chunk a. This lets you process the chunks received from stdout and stderr lazil, in the order they are received, as well as the exit code. Utilities to handle Chunks are provided in System.Process.ListLike.

Utility functions based on showCommandForUser

2 declarations

The Chunk type

5 declarations
datadata Chunk a
#

This type is a concrete representation of the methods of class ProcessOutput. If you take your process output as this type you could, for example, echo all the output and then use collectOutput below to convert it to any other instance of ProcessOutput.

Constructors

Instances3ProcessResult, Show
valuecollectOutput :: ProcessResult a b => [Chunk a] -> b
#

Turn a [Chunk a] into any other instance of ProcessOutput. I usually use this after processing the chunk list to turn it into the (ExitCode, String, String) type returned by readProcessWithExitCode.

Re-exports from process

5 declarations
datadata CmdSpec
#

Constructors

  • ShellCommand String

    A 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.

Instances3Eq, Show, IsString
  • Eq CmdSpecDefined in process-1.6.26.1 · System.Process.Common
  • Show CmdSpecDefined in process-1.6.26.1 · System.Process.Common
  • IsString CmdSpecDefined in process-1.6.26.1 · System.Process.Common

    construct a ShellCommand from a string literal

datadata CreateProcess
#

Constructors

  • CreateProcess
    • cmdspec :: CmdSpec

      Executable & 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 FilePath

      Optional path to the working directory for the new process

    • env :: Maybe [(String, String)]

      Optional environment (otherwise inherit from the current process)

    • std_in :: StdStream

      How to determine stdin

    • std_out :: StdStream

      How to determine stdout

    • std_err :: StdStream

      How to determine stderr XXX verify what happens with fds in nodejs child processes

    • close_fds :: Bool

      Close 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 :: Bool

      Create a new process group. On JavaScript this also creates a new session.

    • delegate_ctlc :: Bool

      Delegate control-C handling. Use this for interactive console processes to let them handle control-C themselves (see below for details).

    • detach_console :: Bool

      Use the windows DETACHED_PROCESS flag when creating the process; does nothing on other platforms.

    • create_new_console :: Bool

      Use the windows CREATE_NEW_CONSOLE flag when creating the process; does nothing on other platforms.

      Default: False

    • new_session :: Bool

      Use 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 GroupID

      Use 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 UserID

      Use 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 :: Bool

      On 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

Instances4Eq, Show, ProcessMaker

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).

Orphan instances

3 instances