Process module:System -package:unix -is:module -package:Win32 -package:typed-process -package:process -package:base

Process a list of flags (usually obtained from getArgs/expandArgsAt) with a mode. Returns Left and an error message if the command line fails to parse, or Right and the associated value.
CPU options impacting cryptography implementation and library performance.
The identifier of the CPU-time clock associated with the calling process. For this clock, the value returned by getTime represents the amount of execution time of the current process.
This will always come first, before any output or exit code.
An exception that is raised when a process fails.
The exit code of the process.
Process the flags obtained by getArgs and expandArgsAt with a mode. Displays an error and exits with failure if the command line fails to parse, or returns the associated value. Implemented in terms of process. This function makes use of the following environment variables:
  • $CMDARGS_COMPLETE - causes the program to produce completions using complete, then exit. Completions are based on the result of getArgs, the index of the current argument is taken from $CMDARGS_COMPLETE (set it to - to complete the last argument), and the index within that argument is taken from $CMDARGS_COMPLETE_POS (if set).
  • $CMDARGS_HELPER/$CMDARGS_HELPER_PROG - uses the helper mechanism for entering command line programs as described in System.Console.CmdArgs.Helper.
Process a list of flags (usually obtained from getArgs and expandArgsAt) with a mode. Throws an error if the command line fails to parse, or returns the associated value. Implemeneted in terms of process. This function does not take account of any environment variables that may be set (see processArgs). If you are in IO you will probably get a better user experience by calling processValueIO.
Like processValue but on failure prints to stderr and exits the program.
Options which have been enabled at compile time and are supported by the current CPU.
Deprecated: Please use pipeBytes instead.
Deprecated: Please use pipeChunks instead.
Logical Processor Index
processing function called asynchronously after a file is added to the rotation
This is the most general way to spawn an external process. The process can be a command line to be executed by a shell or a raw command with a list of arguments. The stdin, stdout, and stderr streams of the new process may individually be attached to new pipes, to existing Handles, or just inherited from the parent (the default.) The details of how to create the process are passed in the CreateProcess record. To make it easier to construct a CreateProcess, the functions proc and shell are supplied that fill in the fields with default values which can be overriden as needed. createProcess returns (mb_stdin_hdl, mb_stdout_hdl, mb_stderr_hdl, ph), where
  • if std_in == CreatePipe, then mb_stdin_hdl will be Just h, where h is the write end of the pipe connected to the child process's stdin.
  • otherwise, mb_stdin_hdl == Nothing
Similarly for mb_stdout_hdl and mb_stderr_hdl. For example, to execute a simple ls command:
r <- createProcess (proc "ls" [])
To create a pipe from which to read the output of ls:
(_, Just hout, _, _) <-
createProcess (proc "ls" []){ std_out = CreatePipe }
To also set the directory in which to run ls:
(_, Just hout, _, _) <-
createProcess (proc "ls" []){ cwd = Just "/home/bob",
std_out = CreatePipe }
Note that Handles provided for std_in, std_out, or std_err via the UseHandle constructor will be closed by calling this function. This is not always the desired behavior. In cases where you would like to leave the Handle open after spawning the child process, please use createProcess_ instead. All created Handles are initially in text mode; if you need them to be in binary mode then use hSetBinaryMode.