| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
System.Process.CommunicationHandle.Internal
Synopsis
- newtype CommunicationHandle = CommunicationHandle Fd
- closeCommunicationHandle :: CommunicationHandle -> IO ()
- useCommunicationHandle :: Bool -> CommunicationHandle -> IO Handle
- createCommunicationPipe :: (forall a. (a, a) -> (a, a)) -> Bool -> IO (Handle, CommunicationHandle)
CommunicationHandle: a Handle that can be serialised,
newtype CommunicationHandle Source #
A CommunicationHandle is an abstraction over operating-system specific
internal representation of a Handle , which can be communicated through a
command-line interface.
In a typical use case, the parent process creates a pipe, using e.g.
createWeReadTheyWritePipe or createTheyReadWeWritePipe.
- One end of the pipe is a
Handle, which can be read from/written to by the parent process. - The other end is a
CommunicationHandle, which can be inherited by a child process. A reference to the handle can be serialised (using theShowinstance), and passed to the child process. It is recommended to close the parent's reference to theCommunicationHandleusingcloseCommunicationHandleafter it has been inherited by the child process. - The child process can deserialise the
CommunicationHandle(using theReadinstance), and then useopenCommunicationHandleWriteoropenCommunicationHandleReadin order to retrieve aHandlewhich it can write to/read from.
readCreateProcessWithExitCodeCommunicationHandle provides a high-level API
to this functionality. See there for example code.
Since: 1.6.20.0
Constructors
Instances
Instances details
Instance details
Defined in System.Process.CommunicationHandle.Internal
Methods
readsPrec :: Int -> ReadS CommunicationHandle #
readList :: ReadS [CommunicationHandle] #
Instance details
Defined in System.Process.CommunicationHandle.Internal
Methods
showsPrec :: Int -> CommunicationHandle -> ShowS #
show :: CommunicationHandle -> String #
showList :: [CommunicationHandle] -> ShowS #
Instance details
Defined in System.Process.CommunicationHandle.Internal
Methods
(==) :: CommunicationHandle -> CommunicationHandle -> Bool #
(/=) :: CommunicationHandle -> CommunicationHandle -> Bool #
Instance details
Defined in System.Process.CommunicationHandle.Internal
Methods
compare :: CommunicationHandle -> CommunicationHandle -> Ordering #
(<) :: CommunicationHandle -> CommunicationHandle -> Bool #
(<=) :: CommunicationHandle -> CommunicationHandle -> Bool #
(>) :: CommunicationHandle -> CommunicationHandle -> Bool #
(>=) :: CommunicationHandle -> CommunicationHandle -> Bool #
max :: CommunicationHandle -> CommunicationHandle -> CommunicationHandle #
min :: CommunicationHandle -> CommunicationHandle -> CommunicationHandle #
closeCommunicationHandle :: CommunicationHandle -> IO () Source #
Close a CommunicationHandle .
Use this to close the CommunicationHandle in the parent process after
the CommunicationHandle has been inherited by the child process.
Since: 1.6.20.0
Internal functions
useCommunicationHandle :: Bool -> CommunicationHandle -> IO Handle Source #
Internal function used to define openCommunicationHandleRead and
openCommunicationHandleWrite.