io-streams-1.5.1.0: Simple, composable, and easy-to-use stream I/O
Safe HaskellNone
LanguageHaskell2010

System.IO.Streams.Process

Description

A module adapting the functions from System.Process to work with io-streams.

Synopsis

Documentation

createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) #

getProcessExitCode :: ProcessHandle -> IO (Maybe ExitCode) #

proc :: FilePath -> [String] -> CreateProcess #

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 #

waitForProcess :: ProcessHandle -> IO ExitCode #

data CmdSpec #

Constructors

ShellCommand String 
RawCommand FilePath [String] 

Instances

Instances details
Eq CmdSpec 
Instance details

Defined in System.Process.Common

Methods

(==) :: CmdSpec -> CmdSpec -> Bool

(/=) :: CmdSpec -> CmdSpec -> Bool

Show CmdSpec 
Instance details

Defined in System.Process.Common

Methods

showsPrec :: Int -> CmdSpec -> ShowS

show :: CmdSpec -> String

showList :: [CmdSpec] -> ShowS

IsString CmdSpec 
Instance details

Defined in System.Process.Common

Methods

fromString :: String -> 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

Instances details
Eq CreateProcess 
Instance details

Defined in System.Process.Common

Show CreateProcess 
Instance details

Defined in System.Process.Common

Methods

showsPrec :: Int -> CreateProcess -> ShowS

show :: CreateProcess -> String

showList :: [CreateProcess] -> ShowS

data StdStream #

Constructors

Inherit 
UseHandle Handle 
CreatePipe 
NoStream 

Instances

Instances details
Eq StdStream 
Instance details

Defined in System.Process.Common

Methods

(==) :: StdStream -> StdStream -> Bool

(/=) :: StdStream -> StdStream -> Bool

Show StdStream 
Instance details

Defined in System.Process.Common

Methods

showsPrec :: Int -> StdStream -> ShowS

show :: StdStream -> String

showList :: [StdStream] -> ShowS

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 proc for details)

-> [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