process-listlike-0.10: Process extras

Safe HaskellNone

System.Process.Chunks

Description

Support for using the Chunk list returned by readProcessChunks.

Synopsis

Documentation

data Chunk a Source

A concrete representation of the methods in ProcessOutput.

Constructors

ProcessHandle ProcessHandle

This will always come first

Stdout a 
Stderr a 
Exception SomeException 
Result ExitCode 

Instances

ListLikeLazyIO a c => ProcessOutput a [Chunk a] 
ListLikeLazyIO a c => ProcessOutput a (ExitCode, [Chunk a]) 

readCreateProcessChunks :: ListLikeLazyIO a c => CreateProcess -> a -> IO [Chunk a]Source

A concrete use of readCreateProcess - build a list containing chunks of process output, any exceptions that get thrown, and finally an exit code. If a is a lazy type the returned list will be lazy.

discardEmptyChunks :: ListLikeLazyIO a c => [Chunk a] -> [Chunk a]Source

Eliminate empty Stdout or Stderr chunks.

fuseChunks :: ListLikeLazyIO a c => [Chunk a] -> [Chunk a]Source

Merge adjacent Stdout or Stderr chunks. This may be undesirable if you want to get your input as soon as it becomes available, it has the effect of making the result less lazy.

collectProcessTriple :: Monoid a => [Chunk a] -> (ExitCode, a, a)Source

collectProcessResult :: Monoid a => [Chunk a] -> (ExitCode, [Chunk a])Source

collectProcessOutput :: Monoid a => [Chunk a] -> (ExitCode, a)Source

indentChunks :: forall a c. (ListLikeLazyIO a c, Eq c, IsString a) => String -> String -> [Chunk a] -> [Chunk a]Source

Pure function to indent the text of a chunk list.

dotifyChunks :: forall a c. ListLikeLazyIO a c => Int -> c -> [Chunk a] -> [Chunk a]Source

putChunk :: ListLikeLazyIO a c => Chunk a -> IO ()Source

Write the Stdout chunks to stdout and the Stderr chunks to stderr.

putMappedChunks :: ListLikeLazyIO a c => ([Chunk a] -> [Chunk a]) -> [Chunk a] -> IO [Chunk a]Source

Apply a function to the chunk list and output the result, return the original (unmodified) chunk list.

putIndented :: (ListLikeLazyIO a c, Eq c, IsString a) => String -> String -> [Chunk a] -> IO [Chunk a]Source

Output the indented text of a chunk list, but return the original unindented list.

putIndentedShowCommand :: (ListLikeLazyIO a c, Eq c, IsString a) => CreateProcess -> String -> String -> [Chunk a] -> IO [Chunk a]Source

putDots :: ListLikeLazyIO a c => Int -> c -> [Chunk a] -> IO [Chunk a]Source

Output the dotified text of a chunk list. Returns the original (undotified) list.

putDotsLn :: forall a c. (IsString a, ListLikeLazyIO a c) => Int -> c -> [Chunk a] -> IO [Chunk a]Source

Output the dotified text of a chunk list with a newline at EOF. Returns the original list.

insertCommandStart :: (IsString a, ListLikeLazyIO a c, Eq c) => CreateProcess -> [Chunk a] -> [Chunk a]Source

Insert a chunk displaying the command and its arguments at the beginning of the chunk list.

insertCommandResult :: (IsString a, ListLikeLazyIO a c, Eq c) => CreateProcess -> [Chunk a] -> [Chunk a]Source

Insert a chunk displaying the command and the result code.

insertCommandDisplay :: (IsString a, ListLikeLazyIO a c, Eq c) => CreateProcess -> [Chunk a] -> [Chunk a]Source

showCreateProcessForUser :: CreateProcess -> StringSource

showCmdSpecForUser :: CmdSpec -> StringSource