úΛB˜;"      !portable experimentallibraries@haskell.org Trustworthy!Create a new pipe. The returned  Handle will use the default encoding $ and newline translation mode (just  like Handle s created by openFile). Use the supplied Handle Inherit Handle from parent 8the filename of an executable with a list of arguments.  see # for the precise interpretation of  the FilePath field. *a command line to execute using the shell  Executable & arguments, or shell command ;Optional path to the working directory for the new process BOptional environment (otherwise inherit from the current process) How to determine stdin How to determine stdout How 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 "AA 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  which may be used $ to wait for the process later. ! #$"%&'()*+#function name (for error messages) handler for SIGINT handler for SIGQUIT ,-./0$123 #$"%&'()*+,-./0  #$"&%'()*+,-./0#non-portable (requires concurrency) experimentallibraries@haskell.org Trustworthy Runs a command using the shell. *Runs a raw command, optionally specifying 4s from which to  take the stdin, stdout and stderr channels for the new E process (otherwise these handles are inherited from the current  process). Any 4 s passed to  are placed immediately in the  closed state. &Note: consider using the more general  instead of  .  Construct a  record for passing to , , representing a raw command with arguments. The FilePath4 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 8 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 D directory containing the parent executable is searched, followed D by the current directory, then some some standard locations, and  finally the current PATH. An .exe extension is added if the B filename does not already have an extension. For full details ) see the documentation for the Windows  SearchPath API.  Construct a  record for passing to , 3 representing a command to be passed to the shell. @This is the most general way to spawn an external process. The Iprocess can be a command line to be executed by a shell or a raw command Dwith a list of arguments. The stdin, stdout, and stderr streams of Gthe new process may individually be attached to new pipes, to existing 44s, 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 Afill in the fields with default values which can be overriden as needed.  returns /(mb_stdin_hdl, mb_stdout_hdl, mb_stderr_hdl, p), where  if std_in == CreatePipe, then  mb_stdin_hdl will be Just h,  where h5 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" []) 2To 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 } ,Runs a command using the shell, and returns 4 s that may 5 be used to communicate with the process via its stdin, stdout,  and stderr respectively. The 4s are initially in binary 8 mode; if you need them to be in text mode then use 5.  Runs a raw command, and returns 4"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:  4 (inp,out,err,pid) <- runInteractiveProcess "..."  forkIO (hPutStr inp str) The 47s are initially in binary mode; if you need them to be  in text mode then use 5. IWaits for the specified process to terminate, and returns its exit code. GHC Note: in order to call waitForProcess without blocking all the D other threads in the system, you must compile the program with   -threaded.  readProcess6 forks an external process, reads its standard output I 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 5 wait (block) until the process has been terminated. 9Output is returned strictly, so this is not suitable for  interactive applications. This function throws an 6 if the process 7 is  anything other than 8. +Users of this function should compile with  -threaded 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: E The command to run, which must be in the $PATH, or an absolute path : A list of separate command line arguments to the program 8 A string to pass on the standard input to the program. readProcessWithExitCode( creates an external process, reads its Estandard output and standard error strictly, waits until the process !terminates, and then returns the 7 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.  and  are fairly simple wrappers around /. Constructing variants of these functions is :quite easy: follow the link to the source code to see how  is implemented.  Computation  system cmd) returns the exit code produced when the (operating system runs the shell command cmd. This computation may fail with  PermissionDenied-: The process has insufficient privileges to  perform the operation.  ResourceExhausted*: Insufficient resources are available to  perform the operation.  UnsupportedOperation&: The implementation does not support  system calls.  On Windows, + passes the command to the Windows command  interpreter (CMD.EXE or  COMMAND.COM), hence Unixy shell tricks will not work. The computation  cmd args# runs the operating system command cmd1 in such a way that it receives as arguments the args strings Iexactly as given, with no funny escaping or shell meta-syntax expansion. FIt will therefore behave more portably between operating systems than . ;The return codes and possible failures are the same as for . Given a program p and arguments args,  showCommandForUser p args' returns a string suitable for pasting 3 into sh (on POSIX OSs) or cmd.exe (on Windows). CAttempts to terminate the specified process. This function should L not be used under normal circumstances - no guarantees are given regarding F how cleanly the process is terminated. To check whether the process  has indeed terminated, use !. On Unix systems, ' sends the process the SIGTERM signal.  On Windows systems, the Win32 TerminateProcess function is called, passing  an exit code of 1. @Note: on Windows, if the process was a shell command created by   with , or created by  or  , then  will only E terminate the shell, not the command itself. On Unix systems, both C processes are in a process group and will be terminated together. ESends an interrupt signal to the process group of the given process. 7On Unix systems, it sends the group the SIGINT signal. KOn Windows systems, it generates a CTRL_BREAK_EVENT and will only work for  processes created using  and setting the  flag !"This is a non-blocking version of . If the process is still running, 9/ is returned. If the process has exited, then : e is returned where e" is the exit code of the process.  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)  Filename of the executable (see  for details) $Arguments to pass to the executable 'Optional path to the working directory )Optional environment (otherwise inherit)  Filename of the executable (see  for details) any arguments standard input stdout  Filename of the executable (see  for details) any arguments standard input exitcode, stdout, stderr  A process in the process group !"  !" !  !portable provisionallibraries@haskell.org Trustworthy;       !"#$%&'()*+,-./0123456786793:;3<=3>?3>@3>A3BC3BDEprocess-1.1.0.2System.ProcessSystem.Process.Internalsproc System.Cmd StdStream CreatePipe UseHandleInheritCmdSpec RawCommand ShellCommand CreateProcesscmdspeccwdenvstd_instd_outstd_err close_fds create_group ProcessHandle runCommand runProcessshell createProcessrunInteractiveCommandrunInteractiveProcesswaitForProcess readProcessreadProcessWithExitCodesystem rawSystemshowCommandForUserterminateProcessinterruptProcessGroupOfgetProcessExitCodeProcessHandle__PHANDLE ClosedHandle OpenHandlewithProcessHandlewithProcessHandle_mkProcessHandle closePHANDLErunGenProcess_ ignoreSignal defaultSignal translatewithFilePathExceptionwithCEnvironmentbaseGHC.IO.Handle.FD fdToHandle unix-2.5.1.0System.Posix.Process.InternalspPrPr_disableITimers c_execvpeGHC.IO.Handle.TypesHandle GHC.IO.HandlehSetBinaryModeGHC.IO.ExceptionIOErrorExitCode ExitSuccess Data.MaybeNothingJust