what4-1.6.3: Solver-agnostic symbolic values support for issuing queries

Safe Haskell | None
Language | Haskell2010

What4.Utils.HandleReader

Synopsis

- teeInputStream :: InputStream a -> OutputStream a -> IO (InputStream a)
- teeOutputStream :: OutputStream a -> OutputStream a -> IO (OutputStream a)
- lineBufferedOutputStream :: Text -> OutputStream Text -> IO (OutputStream Text)
- demuxProcessHandles :: Handle -> Handle -> Handle -> Maybe (Text, Handle) -> IO (OutputStream Text, InputStream Text, HandleReader)
- data HandleReader = HandleReader {
  - hrChan :: !(Chan (Maybe Text))
  - hrHandle :: !Handle
  - hrThreadId :: !ThreadId
  }
- streamLines :: Chan (Maybe Text) -> Handle -> Maybe (OutputStream Text) -> IO ()
- startHandleReader :: Handle -> Maybe (OutputStream Text) -> IO HandleReader
- stopHandleReader :: HandleReader -> IO ()
- withHandleReader :: Handle -> Maybe (OutputStream Text) -> (HandleReader -> IO a) -> IO a
- readNextLine :: HandleReader -> IO (Maybe Text)
- readAllLines :: HandleReader -> IO Text

# Documentation

teeInputStream :: InputStream a -> OutputStream a -> IO (InputStream a) Source #

teeOutputStream :: OutputStream a -> OutputStream a -> IO (OutputStream a) Source #

lineBufferedOutputStream :: Text -> OutputStream Text -> IO (OutputStream Text) Source #

demuxProcessHandles Source #

Arguments

:: Handle | stdin for process
-> Handle | stdout for process
-> Handle | stderr for process
-> Maybe (Text, Handle) |
-> IO (OutputStream Text, InputStream Text, HandleReader) |

data HandleReader Source #

Wrapper to help with reading from another process's standard out and stderr.

We want to be able to read from another process's stderr and stdout without causing the process to stall because `stdout` or `stderr` becomes full. This data type will read from either of the handles, and buffer as much data as needed in the queue. It then provides a line-based method for reading that data as strict bytestrings.

Constructors

HandleReader |

Fields

- hrChan :: !(Chan (Maybe Text))
- hrHandle :: !Handle
- hrThreadId :: !ThreadId

streamLines :: Chan (Maybe Text) -> Handle -> Maybe (OutputStream Text) -> IO () Source #

startHandleReader :: Handle -> Maybe (OutputStream Text) -> IO HandleReader Source #

Create a new handle reader for reading the given handle.

stopHandleReader :: HandleReader -> IO () Source #

Stop the handle reader; cannot be used afterwards.

withHandleReader :: Handle -> Maybe (OutputStream Text) -> (HandleReader -> IO a) -> IO a Source #

Run an execution with a handle reader and stop it wheen down

readNextLine :: HandleReader -> IO (Maybe Text) Source #

readAllLines :: HandleReader -> IO Text Source #