Safe Haskell | None |
---|---|
Language | Haskell2010 |
System.IO.Streams.Process
Description
A module adapting the functions from System.Process to work with
io-streams
.
Synopsis
- proc :: FilePath -> [String] -> CreateProcess
- data CmdSpec
- = ShellCommand String
- | RawCommand FilePath [String]
- data CreateProcess = CreateProcess CmdSpec (Maybe FilePath) (Maybe [(String, String)]) StdStream StdStream StdStream Bool Bool Bool Bool Bool Bool (Maybe GroupID) (Maybe UserID) Bool
- data ProcessHandle
- data StdStream
- = Inherit
- | UseHandle Handle
- | CreatePipe
- | NoStream
- createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode)
- interruptProcessGroupOf :: ProcessHandle -> IO ()
- rawSystem :: String -> [String] -> IO ExitCode
- readProcess :: FilePath -> [String] -> String -> IO String
- readProcessWithExitCode :: FilePath -> [String] -> String -> IO (ExitCode, String, String)
- runCommand :: String -> IO ProcessHandle
- shell :: String -> CreateProcess
- showCommandForUser :: FilePath -> [String] -> String
- system :: String -> IO ExitCode
- terminateProcess :: ProcessHandle -> IO ()
- waitForProcess :: ProcessHandle -> IO ExitCode
- runInteractiveCommand :: String -> IO (OutputStream ByteString, InputStream ByteString, InputStream ByteString, ProcessHandle)
- runInteractiveProcess :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> IO (OutputStream ByteString, InputStream ByteString, InputStream ByteString, ProcessHandle)
Documentation
proc :: FilePath -> [String] -> CreateProcess #
Constructors
ShellCommand String | |
RawCommand FilePath [String] |
Instances
IsString CmdSpec | |
Defined in System.Process.Common Methods fromString :: String -> CmdSpec | |
Show CmdSpec | |
Eq CmdSpec | |
data CreateProcess #
Constructors
CreateProcess CmdSpec (Maybe FilePath) (Maybe [(String, String)]) StdStream StdStream StdStream Bool Bool Bool Bool Bool Bool (Maybe GroupID) (Maybe UserID) Bool |
Instances
Show CreateProcess | |
Defined in System.Process.Common Methods showsPrec :: Int -> CreateProcess -> ShowS show :: CreateProcess -> String showList :: [CreateProcess] -> ShowS | |
Eq CreateProcess | |
Defined in System.Process.Common |
data ProcessHandle #
Constructors
Inherit | |
UseHandle Handle | |
CreatePipe | |
NoStream |
createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) #
getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode) #
interruptProcessGroupOf :: ProcessHandle -> IO () #
readProcess :: FilePath -> [String] -> String -> IO String #
readProcessWithExitCode :: FilePath -> [String] -> String -> IO (ExitCode, String, String) #
runCommand :: String -> IO ProcessHandle #
shell :: String -> CreateProcess #
showCommandForUser :: FilePath -> [String] -> String #
terminateProcess :: ProcessHandle -> IO () #
waitForProcess :: ProcessHandle -> IO ExitCode #
runInteractiveCommand :: String -> IO (OutputStream ByteString, InputStream ByteString, InputStream ByteString, ProcessHandle) Source #
Runs a command using the shell, and returns streams that may be used to communicate with the process via its stdin, stdout, and stderr respectively.
The streams returned by this command are guarded by locks and are therefore safe to use in multithreaded code.
Since: 1.0.2.0
runInteractiveProcess Source #
Arguments
:: FilePath | Filename of the executable (see |
-> [String] | Arguments to pass to the executable |
-> Maybe FilePath | Optional path to the working directory |
-> Maybe [(String, String)] | Optional environment (otherwise inherit) |
-> IO (OutputStream ByteString, InputStream ByteString, InputStream ByteString, ProcessHandle) |
Runs a raw command, and returns streams 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:
(inp,out,err,pid) <- runInteractiveProcess "..." forkIO (Streams.write (Just str) inp)
The streams returned by this command are guarded by locks and are therefore safe to use in multithreaded code.
Since: 1.0.2.0