-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Process extras -- -- Extends http://hackage.haskell.org/package/process. Read -- process input and output as ByteStrings or Text, or write your own -- ProcessOutput instance. Lazy process input and output. ProcessMaker -- class for more flexibility in the process creation API. @package process-extras @version 0.7 module System.Process.Common class ProcessMaker a process :: ProcessMaker a => a -> IO (Handle, Handle, Handle, ProcessHandle) showProcessMakerForUser :: ProcessMaker a => a -> String -- | Process IO is based on the ListLikeIO class from the ListLike -- package class ListLikeIO text char => ListLikeProcessIO text char forceOutput :: ListLikeProcessIO text char => text -> IO text -- | Read from a handle, returning a lazy list of the monoid a. readChunks :: ListLikeProcessIO text char => Handle -> IO [text] class (IsString text, Monoid text, ListLike text char) => ProcessText text char class Monoid result => ProcessResult text result | result -> text pidf :: ProcessResult text result => ProcessHandle -> result outf :: ProcessResult text result => text -> result errf :: ProcessResult text result => text -> result intf :: ProcessResult text result => SomeException -> result codef :: ProcessResult text result => ExitCode -> result -- | Like readProcessWithExitCode, but with generalized input and -- output type. Aside from the usual text-like types, the output can be a -- list of Chunk a. This lets you process the chunks received from stdout -- and stderr lazil, in the order they are received, as well as the exit -- code. Utilities to handle Chunks are provided in -- System.Process.ListLike. readProcessWithExitCode :: ListLikeProcessIO text char => FilePath -> [String] -> text -> IO (ExitCode, text, text) readCreateProcessWithExitCode :: (ProcessMaker maker, ListLikeProcessIO text char) => maker -> text -> IO (ExitCode, text, text) readCreateProcessStrict :: (ProcessMaker maker, ProcessResult text result, ListLikeProcessIO text char) => maker -> text -> IO result -- | Like readCreateProcessStrict, but the output is read lazily. readCreateProcessLazy :: (ProcessMaker maker, ProcessResult a b, ListLikeProcessIO a c) => maker -> a -> IO b showCmdSpecForUser :: CmdSpec -> String -- | System.Process utility functions. showCreateProcessForUser :: CreateProcess -> String instance System.Process.Common.ProcessMaker System.Process.Common.CreateProcess instance System.Process.Common.ProcessMaker (System.Process.Common.CreateProcess, GHC.IO.Handle.Types.BufferMode, GHC.IO.Handle.Types.BufferMode) instance System.Process.Common.ListLikeProcessIO text char => System.Process.Common.ProcessResult text (GHC.IO.Exception.ExitCode, text, text) instance GHC.Base.Monoid GHC.IO.Exception.ExitCode module System.Process.Text -- | Like readProcessWithExitCode, but using Text -- | Specialized version for backwards compatibility. readProcessWithExitCode :: FilePath -> [String] -> Text -> IO (ExitCode, Text, Text) readCreateProcessWithExitCode :: CreateProcess -> Text -> IO (ExitCode, Text, Text) instance System.Process.Common.ProcessText Data.Text.Internal.Text GHC.Types.Char instance System.Process.Common.ListLikeProcessIO Data.Text.Internal.Text GHC.Types.Char module System.Process.Text.Builder -- | Like readProcessWithExitCode, but using Text -- | Specialized version for backwards compatibility. readProcessWithExitCode :: FilePath -> [String] -> Builder -> IO (ExitCode, Builder, Builder) readCreateProcessWithExitCode :: CreateProcess -> Builder -> IO (ExitCode, Builder, Builder) instance System.Process.Common.ListLikeProcessIO Data.Text.Internal.Builder.Builder GHC.Types.Char module System.Process.Text.Lazy -- | Like readProcessWithExitCode, but using Text -- | Specialized version for backwards compatibility. readProcessWithExitCode :: FilePath -> [String] -> Text -> IO (ExitCode, Text, Text) readCreateProcessWithExitCode :: CreateProcess -> Text -> IO (ExitCode, Text, Text) instance System.Process.Common.ProcessText Data.Text.Internal.Lazy.Text GHC.Types.Char instance System.Process.Common.ListLikeProcessIO Data.Text.Internal.Lazy.Text GHC.Types.Char module System.Process.Chars -- | Like readProcessWithExitCode, but specialized for Text -- | Specialized version for backwards compatibility. readProcessWithExitCode :: FilePath -> [String] -> Chars -> IO (ExitCode, Chars, Chars) readCreateProcessWithExitCode :: CreateProcess -> Chars -> IO (ExitCode, Chars, Chars) instance System.Process.Common.ListLikeProcessIO Data.ListLike.Chars.Chars GHC.Types.Char module System.Process.ByteString.Lazy -- | Like readProcessWithExitCode, but using ByteString -- | Specialized version for backwards compatibility. readProcessWithExitCode :: FilePath -> [String] -> ByteString -> IO (ExitCode, ByteString, ByteString) readCreateProcessWithExitCode :: CreateProcess -> ByteString -> IO (ExitCode, ByteString, ByteString) instance System.Process.Common.ProcessText Data.ByteString.Lazy.Internal.ByteString GHC.Word.Word8 instance System.Process.Common.ListLikeProcessIO Data.ByteString.Lazy.Internal.ByteString GHC.Word.Word8 module System.Process.ByteString -- | Like readProcessWithExitCode, but using ByteString -- | Specialized version for backwards compatibility. readProcessWithExitCode :: FilePath -> [String] -> ByteString -> IO (ExitCode, ByteString, ByteString) readCreateProcessWithExitCode :: CreateProcess -> ByteString -> IO (ExitCode, ByteString, ByteString) instance System.Process.Common.ProcessText Data.ByteString.Internal.ByteString GHC.Word.Word8 instance System.Process.Common.ListLikeProcessIO Data.ByteString.Internal.ByteString GHC.Word.Word8 -- | Re-export all symbols and instances of the process-extras package. -- Adds the Chunk type with a ProcessOutput instance, and a collectOutput -- function to turn a list of chunks into any instance of ProcessOutput, -- such as (ExitCode, String, String). This means you can have -- readCreateProcess output a list of Chunk, operate on it to do progress -- reporting, and finally convert it to the type that -- readProcessWithExitCode woud have returned. module System.Process.ListLike -- | Process IO is based on the ListLikeIO class from the ListLike -- package class ListLikeIO text char => ListLikeProcessIO text char forceOutput :: ListLikeProcessIO text char => text -> IO text class (IsString text, Monoid text, ListLike text char) => ProcessText text char class Monoid result => ProcessResult text result | result -> text pidf :: ProcessResult text result => ProcessHandle -> result outf :: ProcessResult text result => text -> result errf :: ProcessResult text result => text -> result intf :: ProcessResult text result => SomeException -> result codef :: ProcessResult text result => ExitCode -> result class ProcessMaker a process :: ProcessMaker a => a -> IO (Handle, Handle, Handle, ProcessHandle) showProcessMakerForUser :: ProcessMaker a => a -> String readCreateProcess :: (ProcessMaker maker, ProcessResult text result, ListLikeProcessIO text char) => maker -> text -> IO result readCreateProcessStrict :: (ProcessMaker maker, ProcessResult text result, ListLikeProcessIO text char) => maker -> text -> IO result -- | Like readCreateProcessStrict, but the output is read lazily. readCreateProcessLazy :: (ProcessMaker maker, ProcessResult a b, ListLikeProcessIO a c) => maker -> a -> IO b readCreateProcessWithExitCode :: (ProcessMaker maker, ListLikeProcessIO text char) => maker -> text -> IO (ExitCode, text, text) -- | Like readProcessWithExitCode, but with generalized input and -- output type. Aside from the usual text-like types, the output can be a -- list of Chunk a. This lets you process the chunks received from stdout -- and stderr lazil, in the order they are received, as well as the exit -- code. Utilities to handle Chunks are provided in -- System.Process.ListLike. readProcessWithExitCode :: ListLikeProcessIO text char => FilePath -> [String] -> text -> IO (ExitCode, text, text) -- | System.Process utility functions. showCreateProcessForUser :: CreateProcess -> String showCmdSpecForUser :: CmdSpec -> String -- | This type is a concrete representation of the methods of class -- ProcessOutput. If you take your process output as this type you could, -- for example, echo all the output and then use collectOutput below to -- convert it to any other instance of ProcessOutput. data Chunk a -- | This will always come first, before any output or exit code. ProcessHandle :: ProcessHandle -> Chunk a Stdout :: a -> Chunk a Stderr :: a -> Chunk a Result :: ExitCode -> Chunk a -- | Note that the instances below do not use this constructor. Exception :: SomeException -> Chunk a -- | Turn a [Chunk a] into any other instance of -- ProcessOutput. I usually use this after processing the chunk -- list to turn it into the (ExitCode, String, String) type returned by -- readProcessWithExitCode. collectOutput :: ProcessResult a b => [Chunk a] -> b foldOutput :: (ProcessHandle -> r) -> (a -> r) -> (a -> r) -> (SomeException -> r) -> (ExitCode -> r) -> Chunk a -> r -- | Send Stdout chunks to stdout and Stderr chunks to stderr. Returns -- input list unmodified. writeOutput :: ListLikeIO a c => [Chunk a] -> IO [Chunk a] writeChunk :: ListLikeIO a c => Chunk a -> IO (Chunk a) data CmdSpec :: * -- | A command line to execute using the shell ShellCommand :: String -> CmdSpec -- | 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: -- --