Skip to content

Capture subprocess stdout and stderr streams independently, resynthesizing and colorizing the streams appropriately

License

Notifications You must be signed in to change notification settings

JuliaPackaging/OutputCollectors.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

Capture subprocess stdout and stderr streams independently, resynthesizing and colorizing the streams appropriately

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •