OutputCollectors.jl Documentation
This is the reference documentation of OutputCollectors.jl
.
Index
OutputCollectors.LineStream
OutputCollectors.OutputCollector
OutputCollectors.OutputCollector
Base.merge
Base.wait
OutputCollectors.alive
OutputCollectors.collect_stderr
OutputCollectors.collect_stdout
OutputCollectors.readuntil_many
OutputCollectors.tail
OutputCollectors.tee
Types
OutputCollectors.OutputCollector
— TypeOutputCollector
A run()
wrapper class that captures subprocess stdout
and stderr
streams independently, resynthesizing and colorizing the streams appropriately.
OutputCollectors.OutputCollector
— MethodOutputCollector(cmd::AbstractCmd; verbose::Bool = false)
Run cmd
, and collect the output such that stdout
and stderr
are captured independently, but with the time of each line recorded such that they can be stored/analyzed independently, but replayed synchronously.
OutputCollectors.LineStream
— MethodLineStream(pipe::Pipe)
Given a Pipe
that has been initialized by spawn()
, create an async Task to read in lines as they come in and annotate the time the line was captured for later replay/merging with other simultaneously captured streams.
Functions
Base.merge
— Methodmerge(collector::OutputCollector; colored::Bool = false)
Merge the stdout and stderr streams of the OutputCollector
on a per-line basis, returning a single string containing all collected lines, interleaved by capture time. If colored
is set to true, embeds terminal color codes to print stderr
in red.
OutputCollectors.collect_stderr
— Methodcollect_stderr(collector::OutputCollector)
Returns all stderr lines collected by this collector so far.
OutputCollectors.collect_stdout
— Methodcollect_stdout(collector::OutputCollector)
Returns all stdout lines collected by this collector so far.
OutputCollectors.tail
— Methodtail(collector::OutputCollector; len::Int = 100, colored::Bool = false)
Write out the last len
lines, optionally writing colored lines.
OutputCollectors.tee
— Methodtee(c::OutputCollector; colored::Bool = false, stream::IO = stdout)
Spawn a background task to incrementally output lines from collector
to the standard output, optionally colored.
Base.wait
— Methodwait(collector::OutputCollector)
Wait for the command and all line streams within an OutputCollector
to finish their respective tasks and be ready for full merging. Return the success of the underlying process. Prints out the last 10 lines of the process if it does not complete successfully unless the OutputCollector was created as verbose
.
OutputCollectors.alive
— Methodalive(s::LineStream)
Returns true
if the task owned by this LineStream
is still processing output from an underlying Pipe
.
OutputCollectors.readuntil_many
— Methodreaduntil_many(s::IO, delims)
Given a collection of delimiter characters, read from s
until one of those delimiters is reached, or we reach the end of s
.