OutputCollectors.jl

Capture subprocess stdout and stderr streams independently, resynthesizing and colorizing the streams appropriately
Author JuliaPackaging
Popularity
13 Stars
Updated Last
6 Months Ago
Started In
June 2020

OutputCollectors.jl

CI

Coverage Status codecov

This package lets you capture subprocess stdout and stderr streams independently, resynthesizing and colorizing the streams appropriately.

Usage

julia> using OutputCollectors

julia> script = """
       #!/bin/sh
       echo 1
       sleep 1
       echo 2 >&2
       sleep 1
       echo 3
       sleep 1
       echo 4
       """
"#!/bin/sh\necho 1\nsleep 1\necho 2 >&2\nsleep 1\necho 3\nsleep 1\necho 4\n"

julia> output = IOBuffer()
       proc, oc = collect_output(`sh -c $script`, [output, stdout])
       success(proc)

1
2
3
4

julia> wait(oc)

julia> String(take!(output))
"1\n2\n3\n4\n"

Required Packages

No packages found.