procex-0.3.0: Ergonomic process launching with extreme flexibility and speed
Safe HaskellNone
LanguageHaskell2010

Procex.Quick

Description

This module defines functions and type classes for making the syntax more succint.

Synopsis

Documentation

(<!|) :: QuickCmd a => Cmd -> Cmd -> a infixl 1 Source #

Pipe from the right command's stderr to the left command. Returns the left command modified.

(<<<) :: (QuickCmd a, ToByteString b) => Cmd -> b -> a infixl 1 Source #

Pass a string as stdin.

(<|) :: QuickCmd a => Cmd -> Cmd -> a infixl 1 Source #

Pipe from the right command to the left command. Returns the left command modified.

(|!>) :: QuickCmd a => Cmd -> Cmd -> a infixl 1 Source #

Pipe from the left command's stderr to the right command. Returns the left command modified.

(|>) :: QuickCmd a => Cmd -> Cmd -> a infixl 1 Source #

Pipe from the left command to the right command. Returns the left command modified.

captureFd :: Fd -> Cmd -> IO ByteString Source #

Capture the output of the fd of the command strictly, err if the command exits with a non-zero exit code.

captureFdNoThrow :: Fd -> Cmd -> IO ByteString Source #

Capture the output of the fd of the command strictly. Ignores process exit code.

captureFdLazy :: Fd -> Cmd -> IO ByteString Source #

Capture the output of the fd of the command lazily. If the process exits with a non-zero exit code, reading from the bytestring will throw CmdException. Garbage collection will close the pipe.

captureFdLazyNoThrow :: Fd -> Cmd -> IO ByteString Source #

Capture the output of the fd of the command lazily. Ignores process exit code. Garbage collection will close the pipe.

pipeArgStrIn :: ToByteString b => b -> Cmd -> Cmd Source #

Pass an argument of the form /proc/self/fd/<n> to the process, where n is the reader end of a pipe which the passed string is written to.

mq Source #

Arguments

:: (QuickCmd a, ToByteString b) 
=> b

The path to the executable, uses PATH

-> a

Either a Cmd, an IO (), or a function that takes Cmd -> Cmd , String or ByteString

>>> mq "cat" "/dev/null" (pipeArgIn 1 $ mq "cat" "/dev/null") <<< "somestr"

The first argument is the path, and the subsequent arguments are QuickCmdArg. At the end you will either have an IO () (synchronous execution) or Cmd (which you can further use).

class QuickCmd a where Source #

A helper class to allow lightweight syntax for executing commands

Methods

quickCmd :: Cmd -> a Source #

Instances

Instances details
QuickCmd Cmd Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmd :: Cmd -> Cmd Source #

a ~ () => QuickCmd (IO a) Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmd :: Cmd -> IO a Source #

(QuickCmdArg a, QuickCmd b) => QuickCmd (a -> b) Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmd :: Cmd -> a -> b Source #

class QuickCmdArg a where Source #

If a type implements this, you can pass it to mq.

Methods

quickCmdArg :: a -> Cmd -> Cmd Source #

Instances

Instances details
QuickCmdArg ByteString Source # 
Instance details

Defined in Procex.Quick

QuickCmdArg [Char] Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmdArg :: [Char] -> Cmd -> Cmd Source #

QuickCmdArg [Cmd -> Cmd] Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmdArg :: [Cmd -> Cmd] -> Cmd -> Cmd Source #

QuickCmdArg [String] Source #

UTF-8 encoded

Instance details

Defined in Procex.Quick

Methods

quickCmdArg :: [String] -> Cmd -> Cmd Source #

QuickCmdArg [ByteString] Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmdArg :: [ByteString] -> Cmd -> Cmd Source #

QuickCmdArg (Cmd -> Cmd) Source # 
Instance details

Defined in Procex.Quick

Methods

quickCmdArg :: (Cmd -> Cmd) -> Cmd -> Cmd Source #

class ToByteString a where Source #

A helper class to convert to bytestrings with UTF-8 encoding

Instances

Instances details
ToByteString ByteString Source # 
Instance details

Defined in Procex.Quick

ToByteString ByteString Source # 
Instance details

Defined in Procex.Quick

a ~ Char => ToByteString [a] Source # 
Instance details

Defined in Procex.Quick

Methods

toByteString :: [a] -> ByteString Source #