-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Enhanced version of process-extras -- -- Extra functionality for the Process library -- http://hackage.haskell.org/package/process. This is a drop-in -- replacement for -- http://hackage.haskell.org/package/process-extras, which adds -- support for creating processes from a CreateProcess, more access to -- the internals, and completes support for the String type. @package process-listlike @version 0.9 -- | Generalized versions of the functions readProcess, and -- readProcessWithExitCode. module System.Process.ListLike -- | Class of types which can be used as the input and outputs of these -- process functions. class ListLikeIO a c => ListLikePlus a c setModes :: ListLikePlus a c => a -> (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO () readChunks :: ListLikePlus a c => Handle -> IO [a] -- | Read the output of a process and use the argument functions to convert -- it into a Monoid, preserving the order of appearance of the different -- chunks of output from standard output and standard error. readProcessInterleaved :: (ListLikePlus a c, Monoid b) => (ProcessHandle -> b) -> (ExitCode -> b) -> (a -> b) -> (a -> b) -> CreateProcess -> a -> IO b -- | Simultaneously read the output from several file handles, using the -- associated functions to add them to a Monoid b in the order they -- appear. This closes each handle on EOF, because AFAIK it is the only -- useful thing to do with a file handle that has reached EOF. readInterleaved :: (ListLikePlus a c, Monoid b) => b -> [(a -> b, Handle)] -> IO b -> IO b -- | An implementation of readProcessWithExitCode with a two -- generalizations: (1) The input and outputs can be any instance of -- ListLikePlus, and (2) The CreateProcess is passes an argument, -- so you can use either proc or rawSystem and you can -- modify its fields such as cwd before the process starts readCreateProcessWithExitCode :: ListLikePlus a c => CreateProcess -> a -> IO (ExitCode, a, a) -- | An implementation of readProcess with a two generalizations: -- (1) The input and outputs can be any instance of ListLikePlus, -- and (2) The CreateProcess is passes an argument, so you can use either -- proc or rawSystem and you can modify its fields such as -- cwd before the process starts -- -- This can't be implemented by calling readProcessInterleaved because -- the std_err field needs to be set to Inherit, which means that -- createProcess returns no stderr handle. Instead, we have a -- nearly identical copy of the readProcessInterleaved code which -- only passes one pair readInterleaved. REMEMBER to keep these -- two in sync if there are future changes! readCreateProcess :: ListLikePlus a c => CreateProcess -> a -> IO a -- | A version of readProcessWithExitCode that uses any instance of -- ListLikePlus instead of String, implemented using -- readCreateProcessWithExitCode. readProcessWithExitCode :: ListLikePlus a c => FilePath -> [String] -> a -> IO (ExitCode, a, a) -- | Implementation of readProcess that uses any instance of -- ListLikePlus instead of String, implemented using -- readCreateProcess. readProcess :: ListLikePlus a c => FilePath -> [String] -> a -> IO a showCmdSpecForUser :: CmdSpec -> String instance Monoid ExitCode module System.Process.Lazy instance ListLikePlus String Char instance ListLikePlus Text Char instance ListLikePlus ByteString Word8 -- | ListLikePlus instances for strict types - these are more dangerous, if -- you start a long running process with them they will block until the -- process finishes. Why not try a lazy type? module System.Process.Strict instance ListLikePlus Text Char instance ListLikePlus ByteString Word8 -- | System.Process.ListLike functions restricted to type -- ByteString. module System.Process.ByteString readProcess :: a ~ ByteString => FilePath -> [String] -> a -> IO a readProcessWithExitCode :: a ~ ByteString => FilePath -> [String] -> a -> IO (ExitCode, a, a) readCreateProcess :: a ~ ByteString => CreateProcess -> a -> IO a readCreateProcessWithExitCode :: a ~ ByteString => CreateProcess -> a -> IO (ExitCode, a, a) -- | System.Process.ListLike functions restricted to the lazy -- ByteString type. module System.Process.ByteString.Lazy readProcess :: a ~ ByteString => FilePath -> [String] -> a -> IO a readProcessWithExitCode :: a ~ ByteString => FilePath -> [String] -> a -> IO (ExitCode, a, a) readCreateProcess :: a ~ ByteString => CreateProcess -> a -> IO a readCreateProcessWithExitCode :: a ~ ByteString => CreateProcess -> a -> IO (ExitCode, a, a) -- | System.Process.ListLike functions restricted to type -- String. module System.Process.String readProcess :: a ~ String => FilePath -> [String] -> a -> IO a readProcessWithExitCode :: a ~ String => FilePath -> [String] -> a -> IO (ExitCode, a, a) readCreateProcess :: a ~ String => CreateProcess -> a -> IO a readCreateProcessWithExitCode :: a ~ String => CreateProcess -> a -> IO (ExitCode, a, a) -- | System.Process.ListLike functions restricted to type -- Text. module System.Process.Text readProcess :: a ~ Text => FilePath -> [String] -> a -> IO a readProcessWithExitCode :: a ~ Text => FilePath -> [String] -> a -> IO (ExitCode, a, a) readCreateProcess :: a ~ Text => CreateProcess -> a -> IO a readCreateProcessWithExitCode :: a ~ Text => CreateProcess -> a -> IO (ExitCode, a, a) -- | System.Process.ListLike functions restricted to the lazy -- Text type. module System.Process.Text.Lazy readProcess :: a ~ Text => FilePath -> [String] -> a -> IO a readProcessWithExitCode :: a ~ Text => FilePath -> [String] -> a -> IO (ExitCode, a, a) readCreateProcess :: a ~ Text => CreateProcess -> a -> IO a readCreateProcessWithExitCode :: a ~ Text => CreateProcess -> a -> IO (ExitCode, a, a) module System.Process.Chunks -- | The output stream of a process returned by readProcessChunks. data Chunk a -- | This will always come first ProcessHandle :: ProcessHandle -> Chunk a Stdout :: a -> Chunk a Stderr :: a -> Chunk a Exception :: IOError -> Chunk a Result :: ExitCode -> Chunk a -- | A concrete use of readProcessInterleaved - build a list -- containing chunks of process output, any exceptions that get thrown -- (unimplemented), and finally an exit code. readProcessChunks :: ListLikePlus a c => CreateProcess -> a -> IO [Chunk a] foldChunk :: (ProcessHandle -> b) -> (a -> b) -> (a -> b) -> (IOError -> b) -> (ExitCode -> b) -> Chunk a -> b -- | Build a value from a chunk stream. foldChunks :: (r -> Chunk a -> r) -> r -> [Chunk a] -> r -- | Write the Stdout chunks to stdout and the Stderr chunks to stderr. putChunk :: ListLikePlus a c => Chunk a -> IO () -- | Merge adjacent Stdout or Stderr chunks. canonicalChunks :: ListLikePlus a c => [Chunk a] -> [Chunk a] -- | Pure function to indent the text of a chunk list. indentChunks :: (ListLikePlus a c, Eq c) => c -> a -> a -> [Chunk a] -> [Chunk a] -- | Output the indented text of a chunk list, but return the original -- unindented list. putIndented :: (ListLikePlus a c, Eq c) => c -> a -> a -> [Chunk a] -> IO [Chunk a] dotifyChunk :: (Monad m, Functor m, ListLikePlus a c) => Int -> c -> Chunk a -> StateT Int m [Chunk a] dotifyChunks :: ListLikePlus a c => Int -> c -> [Chunk a] -> [Chunk a] -- | Output the dotified text of a chunk list, but return the original -- unindented list. putDots :: ListLikePlus a c => Int -> c -> [Chunk a] -> IO [Chunk a] instance Show a => Show (Chunk a) instance Eq BOL instance Show ProcessHandle instance NFData ExitCode