process-1.0.0.1: Process librariesContentsIndex
System.Process.Internals
Portabilityportable
Stabilityexperimental
Maintainerlibraries@haskell.org
Description
Operations for creating and interacting with sub-processes.
Synopsis
newtype ProcessHandle = ProcessHandle (MVar ProcessHandle__)
data ProcessHandle__
= OpenHandle PHANDLE
| ClosedHandle ExitCode
type PHANDLE = CPid
closePHANDLE :: PHANDLE -> IO ()
mkProcessHandle :: PHANDLE -> IO ProcessHandle
withProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO (ProcessHandle__, a)) -> IO a
withProcessHandle_ :: ProcessHandle -> (ProcessHandle__ -> IO ProcessHandle__) -> IO ()
runProcessPosix :: String -> FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Maybe Handle -> Maybe Handle -> Maybe Handle -> Maybe CLong -> Maybe CLong -> IO ProcessHandle
commandToProcess :: String -> IO (FilePath, [String])
withFilePathException :: FilePath -> IO a -> IO a
withCEnvironment :: [(String, String)] -> (Ptr CString -> IO a) -> IO a
Documentation
newtype ProcessHandle
Constructors
ProcessHandle (MVar ProcessHandle__)
data ProcessHandle__

A 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 ProcessHandle which may be used to wait for the process later.

Constructors
OpenHandle PHANDLE
ClosedHandle ExitCode
type PHANDLE = CPid
closePHANDLE :: PHANDLE -> IO ()
mkProcessHandle :: PHANDLE -> IO ProcessHandle
withProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO (ProcessHandle__, a)) -> IO a
withProcessHandle_ :: ProcessHandle -> (ProcessHandle__ -> IO ProcessHandle__) -> IO ()
runProcessPosix
:: String
-> FilePathFilename of the executable
-> [String]Arguments to pass to the executable
-> Maybe FilePathOptional path to the working directory
-> Maybe [(String, String)]Optional environment (otherwise inherit)
-> Maybe HandleHandle to use for stdin
-> Maybe HandleHandle to use for stdout
-> Maybe HandleHandle to use for stderr
-> Maybe CLong
-> Maybe CLong
-> IO ProcessHandle
commandToProcess :: String -> IO (FilePath, [String])

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

withFilePathException :: FilePath -> IO a -> IO a
withCEnvironment :: [(String, String)] -> (Ptr CString -> IO a) -> IO a
Produced by Haddock version 2.2.2