Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data CreateProcess = CreateProcess {
- cmdspec :: CmdSpec
- cwd :: Maybe FilePath
- env :: Maybe [(String, String)]
- std_in :: StdStream
- std_out :: StdStream
- std_err :: StdStream
- close_fds :: Bool
- create_group :: Bool
- delegate_ctlc :: Bool
- detach_console :: Bool
- create_new_console :: Bool
- new_session :: Bool
- child_group :: Maybe GroupID
- child_user :: Maybe UserID
- use_process_jobs :: Bool
- data CmdSpec
- data StdStream
- data Handle
- data ProcessHandle
- data ExitCode
- type FD = CInt
- type Pid = CPid
- createProcess :: Member (Embed IO) r => Member (Error IOException) r => CreateProcess -> Sem r (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- createProcess_ :: Member (Embed IO) r => Member (Error IOException) r => String -> CreateProcess -> Sem r (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- shell :: String -> CreateProcess
- proc :: FilePath -> [String] -> CreateProcess
- callProcess :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> Sem r ()
- callCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r ()
- spawnProcess :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> Sem r ProcessHandle
- spawnCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r ProcessHandle
- readCreateProcess :: Member (Embed IO) r => Member (Error IOException) r => CreateProcess -> String -> Sem r String
- readProcess :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> String -> Sem r String
- readCreateProcessWithExitCode :: Member (Embed IO) r => Member (Error IOException) r => CreateProcess -> String -> Sem r (ExitCode, String, String)
- readProcessWithExitCode :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> String -> Sem r (ExitCode, String, String)
- cleanupProcess :: Member (Embed IO) r => Member (Error IOException) r => (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> Sem r ()
- getPid :: Member (Embed IO) r => Member (Error IOException) r => ProcessHandle -> Sem r (Maybe Pid)
- getCurrentPid :: Member (Embed IO) r => Member (Error IOException) r => Sem r Pid
- interruptProcessGroupOf :: Member (Embed IO) r => Member (Error IOException) r => ProcessHandle -> Sem r ()
- createPipe :: Member (Embed IO) r => Member (Error IOException) r => Sem r (Handle, Handle)
- createPipeFd :: Member (Embed IO) r => Member (Error IOException) r => Sem r (FD, FD)
- runProcess :: Member (Embed IO) r => Member (Error IOException) r => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Maybe Handle -> Maybe Handle -> Maybe Handle -> Sem r ProcessHandle
- runCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r ProcessHandle
- runInteractiveProcess :: Member (Embed IO) r => Member (Error IOException) r => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Sem r (Handle, Handle, Handle, ProcessHandle)
- runInteractiveCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r (Handle, Handle, Handle, ProcessHandle)
- system :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r ExitCode
- rawSystem :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> Sem r ExitCode
- waitSecondsForProcess :: Member (Embed IO) r => Member (Error GenericError) r => Member (Error IOException) r => Member (Error TimedOut) r => Member Log r => Int -> ProcessHandle -> Sem r (Maybe ExitCode)
Documentation
data CreateProcess #
CreateProcess | |
|
Instances
Show CreateProcess | |
Defined in System.Process.Common showsPrec :: Int -> CreateProcess -> ShowS # show :: CreateProcess -> String # showList :: [CreateProcess] -> ShowS # | |
Eq CreateProcess | |
Defined in System.Process.Common (==) :: CreateProcess -> CreateProcess -> Bool # (/=) :: CreateProcess -> CreateProcess -> Bool # |
ShellCommand String | A command line to execute using the shell |
RawCommand FilePath [String] | The name of an executable with a list of arguments The
|
Instances
IsString CmdSpec | construct a Since: process-1.2.1.0 |
Defined in System.Process.Common fromString :: String -> CmdSpec # | |
Show CmdSpec | |
Eq CmdSpec | |
Inherit | Inherit Handle from parent |
UseHandle Handle | Use the supplied Handle |
CreatePipe | Create a new pipe. The returned
|
NoStream | Close the stream's file descriptor without
passing a Handle. On POSIX systems this may
lead to strange behavior in the child process
because attempting to read or write after the
file has been closed throws an error. This
should only be used with child processes that
don't use the file descriptor at all. If you
wish to ignore the child process's output you
should either create a pipe and drain it
manually or pass a |
Haskell defines operations to read and write characters from and to files,
represented by values of type Handle
. Each value of this type is a
handle: a record used by the Haskell run-time system to manage I/O
with file system objects. A handle has at least the following properties:
- whether it manages input or output or both;
- whether it is open, closed or semi-closed;
- whether the object is seekable;
- whether buffering is disabled, or enabled on a line or block basis;
- a buffer (whose length may be zero).
Most handles will also have a current I/O position indicating where the next
input or output operation will occur. A handle is readable if it
manages only input or both input and output; likewise, it is writable if
it manages only output or both input and output. A handle is open when
first allocated.
Once it is closed it can no longer be used for either input or output,
though an implementation cannot re-use its storage while references
remain to it. Handles are in the Show
and Eq
classes. The string
produced by showing a handle is system dependent; it should include
enough information to identify the handle for debugging. A handle is
equal according to ==
only to itself; no attempt
is made to compare the internal state of different handles for equality.
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.
On Windows a second wait method can be used to block for event completion. This requires two handles. A process job handle and a events handle to monitor.
Defines the exit codes that a program can return.
ExitSuccess | indicates successful termination; |
ExitFailure Int | indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system). |
Instances
Exception ExitCode | Since: base-4.1.0.0 |
Defined in GHC.IO.Exception toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # | |
Generic ExitCode | |
Read ExitCode | |
Show ExitCode | |
NFData ExitCode | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Eq ExitCode | |
Ord ExitCode | |
Defined in GHC.IO.Exception | |
type Rep ExitCode | |
Defined in GHC.IO.Exception type Rep ExitCode = D1 ('MetaData "ExitCode" "GHC.IO.Exception" "base" 'False) (C1 ('MetaCons "ExitSuccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExitFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) |
The platform specific type for a process identifier.
This is always an integral type. Width and signedness are platform specific.
Since: process-1.6.3.0
createProcess :: Member (Embed IO) r => Member (Error IOException) r => CreateProcess -> Sem r (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) Source #
createProcess_ :: Member (Embed IO) r => Member (Error IOException) r => String -> CreateProcess -> Sem r (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) Source #
shell :: String -> CreateProcess #
Construct a CreateProcess
record for passing to createProcess
,
representing a command to be passed to the shell.
proc :: FilePath -> [String] -> CreateProcess #
Construct a CreateProcess
record for passing to createProcess
,
representing a raw command with arguments.
See RawCommand
for precise semantics of the specified FilePath
.
callProcess :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> Sem r () Source #
spawnProcess :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> Sem r ProcessHandle Source #
spawnCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r ProcessHandle Source #
readCreateProcess :: Member (Embed IO) r => Member (Error IOException) r => CreateProcess -> String -> Sem r String Source #
readProcess :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> String -> Sem r String Source #
readCreateProcessWithExitCode :: Member (Embed IO) r => Member (Error IOException) r => CreateProcess -> String -> Sem r (ExitCode, String, String) Source #
readProcessWithExitCode :: Member (Embed IO) r => Member (Error IOException) r => String -> [String] -> String -> Sem r (ExitCode, String, String) Source #
cleanupProcess :: Member (Embed IO) r => Member (Error IOException) r => (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> Sem r () Source #
getPid :: Member (Embed IO) r => Member (Error IOException) r => ProcessHandle -> Sem r (Maybe Pid) Source #
interruptProcessGroupOf :: Member (Embed IO) r => Member (Error IOException) r => ProcessHandle -> Sem r () Source #
createPipe :: Member (Embed IO) r => Member (Error IOException) r => Sem r (Handle, Handle) Source #
runProcess :: Member (Embed IO) r => Member (Error IOException) r => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Maybe Handle -> Maybe Handle -> Maybe Handle -> Sem r ProcessHandle Source #
runCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r ProcessHandle Source #
runInteractiveProcess :: Member (Embed IO) r => Member (Error IOException) r => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> Sem r (Handle, Handle, Handle, ProcessHandle) Source #
runInteractiveCommand :: Member (Embed IO) r => Member (Error IOException) r => String -> Sem r (Handle, Handle, Handle, ProcessHandle) Source #