úÎÝâÙH=      !"#$%&'()*+,-./0123456789:;<"(c) The University of Glasgow 2004/BSD-style (see the file libraries/base/LICENSE)libraries@haskell.org experimentalportable Trustworthy "Create a new pipe. The returned HandleI will use the default encoding and newline translation mode (just like Handle s created by openFile).Use the supplied HandleInherit Handle from parent2The name of an executable with a list of argumentsThe = argument names the executable, and is interpreted according to the platform's standard policy for searching for executables. Specifically:on Unix systems the  Ehttp://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html execvp(3)U semantics is used, where if the executable filename does not contain a slash (/ ) then the PATH8 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 .exek extension is added if the filename does not already have an extension. For full details see the  Rhttp://msdn.microsoft.com/en-us/library/windows/desktop/aa365527%28v=vs.85%29.aspx documentation for the Windows  SearchPath API. )A command line to execute using the shell (Executable & arguments, or shell command :Optional path to the working directory for the new processAOptional environment (otherwise inherit from the current process)How to determine stdinHow to determine stdoutHow to determine stderr–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)Create a new process groupˆDelegate control-C handling. Use this for interactive console processes to let them handle control-C themselves (see below for details).On Windows this has no effect.Since: 1.2.0.0[A handle to a process, which can be used to wait for termination of the process using .dNone of the process-creation functions in this library wait for termination: they all return a 6 which may be used to wait for the process later.&This function is almost identical to . The only differences are:>s provided via  are not closed automatically.This function takes an extra String3 argument to be used in creating error messages.*This function has been available from the System.Process.Internals+ module for some time, and is part of the System.Process module since version 1.2.1.0.Since: 1.2.1.0?pTurns a shell command into a raw command. Usually this involves wrapping it in an invocation of the shell.²There's a difference in the signature of commandToProcess between the Windows and Unix versions. On Unix, exec takes a list of strings, and we want to pass our command to binsh as a single argument.”On Windows, CreateProcess takes a single string for the command, which is later decomposed by cmd.exe. In this case, we just want to prepend "c:WINDOWSCMD.EXE /c"Š to our command line. The command-line translation that we normally do for arguments on Windows isn't required (or desirable) here.@ construct a   from a string literalSince: 1.2.1.00 A"function name (for error messages)BC !"#DEFGHI?$%&'"function name (for error messages)handler for SIGINThandler for SIGQUIT@(  !"#$%&'(  ' !"#%&$  ABC !"#DEFGHI?$%&'@'(c) The University of Glasgow 2004-2008/BSD-style (see the file libraries/base/LICENSE)libraries@haskell.org experimental#non-portable (requires concurrency) Trustworthy ( Construct a   record for passing to *-, representing a raw command with arguments.See ( for precise semantics of the specified FilePath.) Construct a   record for passing to *4, representing a command to be passed to the shell.*ÿ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 >3s, or just inherited from the parent (the default.);The details of how to create the process are passed in the  + record. To make it easier to construct a  , the functions ( and )[ are supplied that fill in the fields with default values which can be overriden as needed.* returns ( mb_stdin_hdl,  mb_stdout_hdl,  mb_stderr_hdl, ph), whereif  == , then  mb_stdin_hdl will be Just h , where hB is the write end of the pipe connected to the child process's stdin. otherwise,  mb_stdin_hdl == NothingSimilarly for  mb_stdout_hdl and  mb_stderr_hdl.!For example, to execute a simple ls command: # r <- createProcess (proc "ls" [])2To create a pipe from which to read the output of ls: T (_, 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 Handle3 open after spawning the child process, please use  instead.+Creates a new process to run the specified raw command with the given arguments. It does not wait for the program to finish, but returns the .Since: 1.2.0.0,wCreates a new process to run the specified shell command. It does not wait for the program to finish, but returns the .Since: 1.2.0.0-¯Creates a new process to run the specified command with the given arguments, and wait for it to finish. If the command returns a non-zero exit code, an exception is raised.@If an asynchronous exception is thrown to the thread executing  callProcess-. The forked process will be terminated and  callProcess: will wait (block) until the process has been terminated.Since: 1.2.0.0.€Creates a new process to run the specified shell command. If the command returns a non-zero exit code, an exception is raised.@If an asynchronous exception is thrown to the thread executing  callCommand-. The forked process will be terminated and  callCommand: will wait (block) until the process has been terminated.Since: 1.2.0.0/ readProcess‡ forks an external process, reads its standard output strictly, blocking until the process terminates, and returns the output string.@If an asynchronous exception is thrown to the thread executing  readProcess,. The forked process will be terminated and  readProcess: will wait (block) until the process has been terminated.SOutput is returned strictly, so this is not suitable for interactive applications.This function throws an J if the process K is anything other than L.+Users of this function should compile with  -threadeda if they want other Haskell threads to keep running while waiting on the result of readProcess. = > readProcess "date" [] [] "Thu Feb 7 10:03:39 PST 2008\n"The arguments are:OThe command to run, which must be in the $PATH, or an absolute or relative path8A list of separate command line arguments to the program9A string to pass on standard input to the forked process.0readProcessWithExitCodeŽ creates an external process, reads its standard output and standard error strictly, waits until the process terminates, and then returns the K= 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 readProcessWithExitCode9 will wait (block) until the process has been terminated./ and 0# are fairly simple wrappers around *i. Constructing variants of these functions is quite easy: follow the link to the source code to see how / is implemented.On Unix systems, see 2O for the meaning of exit codes when the process died as the result of a signal.MOFork a thread while doing something else, but kill it if there's an exception.ÌThis is important in the cases above because we want to kill the thread that is holding the Handle lock, because when we clean up the process we try to close that handle, which could otherwise deadlock.1Given 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).2HWaits for the specified process to terminate, and returns its exit code.GHC Note: in order to call waitForProcessY without blocking all the other threads in the system, you must compile the program with  -threaded.(Since: 1.2.0.0$) On Unix systems, a negative value N -signum3 indicates that the child was terminated by signal signumk. The signal numbers are platform-specific, so to test for a specific signal use the constants provided by System.Posix.Signals in the unix1 package. Note: core dumps are not reported, use System.Posix.Process if you need this detail.3"This is a non-blocking version of 2$. If the process is still running, O/ is returned. If the process has exited, then P e is returned where e! is the exit code of the process.On Unix systems, see 2O for the meaning of exit codes when the process died as the result of a signal.4ñ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 3.On Unix systems, 4F sends the process the SIGTERM signal. On Windows systems, the Win32 TerminateProcess0 function is called, passing an exit code of 1.ANote: on Windows, if the process was a shell command created by * with ), or created by 6 or 8, then 4’ will only terminate the shell, not the command itself. On Unix systems, both processes are in a process group and will be terminated together.5DSends an interrupt signal to the process group of the given process.6On Unix systems, it sends the group the SIGINT signal.dOn Windows systems, it generates a CTRL_BREAK_EVENT and will only work for processes created using * and setting the  flag6Runs a command using the shell.7*Runs a raw command, optionally specifying >s from which to take the stdin, stdout and stderri channels for the new process (otherwise these handles are inherited from the current process).Any > s passed to 71 are placed immediately in the closed state.&Note: consider using the more general * instead of 7.8,Runs a command using the shell, and returns >@s that may be used to communicate with the process via its stdin, stdout , and stderr respectively. The >Rs are initially in binary mode; if you need them to be in text mode then use Q.9 Runs a raw command, and returns >@s that may be used to communicate with the process via its stdin, stdout and stderr respectively.?For example, to start a process and feed a string to its stdin: M (inp,out,err,pid) <- runInteractiveProcess "..." forkIO (hPutStr inp str)The >Qs are initially in binary mode; if you need them to be in text mode then use Q.: Computation  system cmdQ returns the exit code produced when the operating system runs the shell command cmd.4This computation may fail with one of the following  exceptions: PermissionDeniedAThe process has insufficient privileges to perform the operation.ResourceExhausted>Insufficient resources are available to perform the operation.UnsupportedOperation1The implementation does not support system calls. On Windows, :8 passes the command to the Windows command interpreter (CMD.EXE or  COMMAND.COM*), hence Unixy shell tricks will not work.On Unix systems, see 2O for the meaning of exit codes when the process died as the result of a signal.;The computation ; cmd args# runs the operating system command cmd1 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 :.;The return codes and possible failures are the same as for :.<;Create a pipe for interprocess communication and return a (readEnd, writeEnd) > pair.Since: 1.2.1.0RST()*UV+,-.W/ Filename of the executable (see  for details) any argumentsstandard inputstdout0 Filename of the executable (see  for details) any argumentsstandard inputexitcode, stdout, stderrMX12345A process in the process group67 Filename of the executable (see  for details)#Arguments to pass to the executable&Optional path to the working directory(Optional environment (otherwise inherit)Handle to use for stdin (Nothing => use existing stdin)Handle to use for stdout (Nothing => use existing stdout)Handle to use for stderr (Nothing => use existing stderr)89 Filename of the executable (see  for details)#Arguments to pass to the executable&Optional path to the working directory(Optional environment (otherwise inherit)Y:;<) ()*+,-./0123456789:;<)*)(  -.+,/012345<7698:;RST()*UV+,-.W/0MX123456789Y:;<"(c) The University of Glasgow 2001/BSD-style (see the file libraries/base/LICENSE)libraries@haskell.org provisionalportable Trustworthy:;:;Z  !!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUTVTWXTYZ[Z\]^_`abcdefgprocess-1.2.1.0System.Process.InternalsSystem.ProcesswaitForProcess createProcessSystem.IO.Error IOErrorType System.CmdbaseGHC.IO.Handle.FD fdToHandle unix-2.7.0.1System.Posix.Process.InternalspPrPr_disableITimers c_execvpe StdStream CreatePipe UseHandleInheritCmdSpec RawCommand ShellCommand CreateProcesscmdspeccwdenvstd_instd_outstd_err close_fds create_group delegate_ctlcPHANDLE ProcessHandleProcessHandle__ ClosedHandle OpenHandlemodifyProcessHandlewithProcessHandlemkProcessHandle closePHANDLEcreateProcess_startDelegateControlCendDelegateControlC ignoreSignal defaultSignal translatewithFilePathExceptionwithCEnvironmentrunGenProcess_procshell spawnProcess spawnCommand callProcess callCommand readProcessreadProcessWithExitCodeshowCommandForUsergetProcessExitCodeterminateProcessinterruptProcessGroupOf runCommand runProcessrunInteractiveCommandrunInteractiveProcesssystem rawSystem createPipeGHC.IOFilePathGHC.IO.Handle.TypesHandlecommandToProcess$fIsStringCmdSpecc_runInteractiveProcessrunInteractiveProcess_lock#runInteractiveProcess_delegate_ctlcfd_stdin fd_stdout fd_stderrmbFdmbPipe pfdToHandleGHC.IO.ExceptionIOErrorExitCode ExitSuccess withForkWait ExitFailure Data.MaybeNothingJust GHC.IO.HandlehSetBinaryModec_waitForProcessc_getProcessExitCodec_terminateProcesswithCreateProcess_cleanupProcessprocessFailedException ignoreSigPiperunInteractiveProcess1