Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines functions and type classes for making the syntax more succint.
Synopsis
- (<!|) :: QuickCmd a => Cmd -> Cmd -> a
- (<<<) :: (QuickCmd a, ToByteString b) => Cmd -> b -> a
- (<|) :: QuickCmd a => Cmd -> Cmd -> a
- (|!>) :: QuickCmd a => Cmd -> Cmd -> a
- (|>) :: QuickCmd a => Cmd -> Cmd -> a
- capture :: Cmd -> IO ByteString
- captureNoThrow :: Cmd -> IO ByteString
- captureLazy :: Cmd -> IO ByteString
- captureLazyNoThrow :: Cmd -> IO ByteString
- captureErr :: Cmd -> IO ByteString
- captureErrNoThrow :: Cmd -> IO ByteString
- captureErrLazy :: Cmd -> IO ByteString
- captureErrLazyNoThrow :: Cmd -> IO ByteString
- captureFd :: Fd -> Cmd -> IO ByteString
- captureFdNoThrow :: Fd -> Cmd -> IO ByteString
- captureFdLazy :: Fd -> Cmd -> IO ByteString
- captureFdLazyNoThrow :: Fd -> Cmd -> IO ByteString
- pipeArgStrIn :: ToByteString b => b -> Cmd -> Cmd
- mq :: (QuickCmd a, ToByteString b) => b -> a
- class QuickCmd a where
- class QuickCmdArg a where
- quickCmdArg :: a -> Cmd -> Cmd
- class ToByteString a where
- toByteString :: a -> ByteString
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 => 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.
captureNoThrow :: Cmd -> IO ByteString Source #
captureFdNoThrow
for stdout.
captureLazy :: Cmd -> IO ByteString Source #
captureFdLazy
for stdout.
captureLazyNoThrow :: Cmd -> IO ByteString Source #
captureFdLazyNoThrow
for stdout.
captureErr :: Cmd -> IO ByteString Source #
captureFd
for stderr.
captureErrNoThrow :: Cmd -> IO ByteString Source #
captureFdNoThrow
for stderr.
captureErrLazy :: Cmd -> IO ByteString Source #
captureFdLazy
for stderr..
captureErrLazyNoThrow :: Cmd -> IO ByteString Source #
captureFdLazyNoThrow
for stderr.
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.
:: (QuickCmd a, ToByteString b) | |
=> b | The path to the executable, uses PATH |
-> a | Either a |
>>>
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 QuickCmdArg a where Source #
If a type implements this, you can pass it to mq
.
quickCmdArg :: a -> Cmd -> Cmd Source #
Instances
QuickCmdArg String Source # | UTF-8 encoded |
Defined in Procex.Quick | |
QuickCmdArg ByteString Source # | |
Defined in Procex.Quick quickCmdArg :: ByteString -> Cmd -> Cmd Source # | |
QuickCmdArg [Cmd -> Cmd] Source # | |
Defined in Procex.Quick | |
a ~ Fd => QuickCmdArg [(a, Handle)] Source # | |
Defined in Procex.Quick | |
a ~ Fd => QuickCmdArg [(a, IO Handle)] Source # | |
Defined in Procex.Quick | |
(a ~ Fd, b ~ Cmd) => QuickCmdArg [(a, (Handle -> IO b) -> IO b)] Source # | |
Defined in Procex.Quick | |
QuickCmdArg [String] Source # | |
Defined in Procex.Quick | |
QuickCmdArg [ByteString] Source # | |
Defined in Procex.Quick quickCmdArg :: [ByteString] -> Cmd -> Cmd Source # | |
QuickCmdArg (Cmd -> Cmd) Source # | |
Defined in Procex.Quick | |
a ~ Fd => QuickCmdArg (a, Handle) Source # | |
Defined in Procex.Quick | |
a ~ Fd => QuickCmdArg (a, IO Handle) Source # | |
Defined in Procex.Quick | |
(a ~ Fd, b ~ Cmd) => QuickCmdArg (a, (Handle -> IO b) -> IO b) Source # | |
Defined in Procex.Quick |
class ToByteString a where Source #
A helper class to convert to bytestrings with UTF-8 encoding
toByteString :: a -> ByteString Source #
Instances
ToByteString ByteString Source # | |
Defined in Procex.Quick toByteString :: ByteString -> ByteString Source # | |
ToByteString ByteString Source # | |
Defined in Procex.Quick toByteString :: ByteString -> ByteString0 Source # | |
a ~ Char => ToByteString [a] Source # | |
Defined in Procex.Quick toByteString :: [a] -> ByteString Source # |