| Copyright | (c) The University of Glasgow 2004 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
System.Process.Internals
Description
Note: This module exports internal implementation details that may change anytime. If you want a more stable API, use System.Process instead.
Synopsis
- data ProcessHandle = ProcessHandle !(MVar ProcessHandle__) !Bool
- data ProcessHandle__
- type PHANDLE = CPid
- closePHANDLE :: PHANDLE -> IO ()
- mkProcessHandle :: PHANDLE -> Bool -> IO ProcessHandle
- modifyProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO (ProcessHandle__, a)) -> IO a
- withProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO a) -> IO a
- data CreateProcess = CreateProcess {}
- data CmdSpec
- data StdStream
- = Inherit
- | UseHandle Handle
- | CreatePipe
- createProcess_ :: String -> CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- runGenProcess_ :: String -> CreateProcess -> Maybe CLong -> Maybe CLong -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- startDelegateControlC :: IO ()
- endDelegateControlC :: ExitCode -> IO ()
- pPrPr_disableITimers :: IO ()
- c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt
- ignoreSignal :: CLong
- defaultSignal :: CLong
- withFilePathException :: FilePath -> IO a -> IO a
- withCEnvironment :: [(String, String)] -> (Ptr CString -> IO a) -> IO a
- translate :: String -> String
- fdToHandle :: FD -> IO Handle
Documentation
data ProcessHandle Source
Constructors
data ProcessHandle__ Source
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.
closePHANDLE :: PHANDLE -> IO () Source
mkProcessHandle :: PHANDLE -> Bool -> IO ProcessHandle Source
modifyProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO (ProcessHandle__, a)) -> IO a Source
withProcessHandle :: ProcessHandle -> (ProcessHandle__ -> IO a) -> IO a Source
data CreateProcess Source
Constructors
Fields
- cmdspec :: CmdSpec
Executable & arguments, or shell command
- cwd :: Maybe FilePath
Optional path to the working directory for the new process
- env :: Maybe [(String, String)]
Optional environment (otherwise inherit from the current process)
- std_in :: StdStream
How to determine stdin
- std_out :: StdStream
How to determine stdout
- std_err :: StdStream
How to determine stderr
- close_fds :: Bool
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_group :: Bool
Create a new process group
- delegate_ctlc :: Bool
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
Constructors
The name of an executable with a list of arguments
The FilePath argument names the executable, and is interpreted
according to the platform's standard policy for searching for
executables. Specifically:
- on Unix systems the
execvp(3)
semantics is used, where if the executable filename does not
contain a slash (
/) then thePATHenvironment variable is searched for the executable. - on Windows systems the Win32
CreateProcesssemantics 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 currentPATH. An.exeextension is added if the filename does not already have an extension. For full details see the documentation for the WindowsSearchPathAPI.
Instances
Constructors
Inherit Handle from parent
Create a new pipe. The returned
Handle will use the default encoding
and newline translation mode (just
like Handles created by openFile).
Arguments
function name (for error messages)
This function is almost identical to
createProcess . The only differences are:
Handles provided viaUseHandleare not closed automatically.- This function takes an extra
Stringargument 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
Arguments
function name (for error messages)
Deprecated: Please do not use this anymore, use the ordinary createProcess . If you need the SIGINT handling, use delegate_ctlc = True (runGenProcess_ is now just an imperfectly emulated stub that probably duplicates or overrides your own signal handling).
startDelegateControlC :: IO () Source
endDelegateControlC :: ExitCode -> IO () Source
pPrPr_disableITimers :: IO ()
withFilePathException :: FilePath -> IO a -> IO a Source
fdToHandle :: FD -> IO Handle
Turn an existing file descriptor into a Handle. This is used by various external libraries to make Handles.
Makes a binary Handle. This is for historical reasons; it should probably be a text Handle with the default encoding and newline translation instead.