Running sub-processes

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.

The FilePath names the executable, and is interpreted according
to the platform's standard policy for searching for
executables. Specifically:

on Unix systems the execvp semantics is used, where if the
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 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.

Runs a command using the shell, and returns Handles that may
be used to communicate with the process via its stdin, stdout,
and stderr respectively. The Handles are initially in binary
mode; if you need them to be in text mode then use hSetBinaryMode.

readProcessWithExitCode creates an external process, reads its
standard output and standard error strictly, waits until the process
terminates, and then returns the ExitCode of the process,
the standard output, and the standard error.

If an asynchronous exception is thrown to the thread executing
readProcessWithExitCode. The forked process will be terminated and
readProcessWithExitCode will wait (block) until the process has been
terminated.

The computation rawSystem cmd args runs the operating system command
cmd in such a way that it receives as arguments the args strings
exactly as given, with no funny escaping or shell meta-syntax expansion.
It will therefore behave more portably between operating systems than system.

Attempts to terminate the specified process. This function should
not be used under normal circumstances - no guarantees are given regarding
how cleanly the process is terminated. To check whether the process
has indeed terminated, use getProcessExitCode.

On Unix systems, terminateProcess sends the process the SIGTERM signal.
On Windows systems, the Win32 TerminateProcess function is called, passing
an exit code of 1.