File tree Expand file tree Collapse file tree 1 file changed +11
-31
lines changed
Expand file tree Collapse file tree 1 file changed +11
-31
lines changed Original file line number Diff line number Diff line change 99[ ![ codecov] ( https://codecov.io/gh/JuliaPackaging/OutputCollectors.jl/branch/master/graph/badge.svg )] ( https://codecov.io/gh/JuliaPackaging/OutputCollectors.jl )
1010
1111
12- This package lets you capture subprocess ` stdout ` and ` stderr ` streams
13- independently, resynthesizing and colorizing the streams appropriately.
14-
15- ## Installation
16-
17- ` OutputCollectors.jl ` can be installed with [ Julia built-in package
18- manager] ( https://julialang.github.io/Pkg.jl/v1/ ) . In a Julia session, after
19- entering the package manager mode with ` ] ` , run the command
20-
21- ```
22- add OutputCollectors.jl
23- ```
12+ This package lets you capture subprocess ` stdout ` and ` stderr ` streams independently, resynthesizing and colorizing the streams appropriately.
2413
2514## Usage
2615
@@ -39,26 +28,17 @@ julia> script = """
3928 """
4029" #!/bin/sh\n echo 1\n sleep 1\n echo 2 >&2\n sleep 1\n echo 3\n sleep 1\n echo 4\n "
4130
42- julia> oc = OutputCollector (` sh -c $script ` ; verbose = true );
31+ julia> output = IOBuffer ()
32+ proc, oc = collect_output (` sh -c $script ` , [output, stdout ])
33+ success (proc)
4334
44- julia> [22 : 42 : 30 ] 1
45- [22 : 42 : 31 ] 2
46- [22 : 42 : 32 ] 3
47- [22 : 42 : 33 ] 4
48- julia>
35+ 1
36+ 2
37+ 3
38+ 4
4939
50- julia> merge (oc)
51- " 1\n 2\n 3\n 4\n "
52-
53- julia> merge (oc; colored = true )
54- " 1\n\e [31m2\n\e [39m3\n 4\n "
55-
56- julia> tail (oc; len = 2 )
57- " 3\n 4\n "
40+ julia> wait (oc)
5841
59- julia> collect_stdout (oc)
60- " 1\n 3\n 4\n "
61-
62- julia> collect_stderr (oc)
63- " 2\n "
42+ julia> String (take! (output))
43+ " 1\n 2\n 3\n 4\n "
6444```
You can’t perform that action at this time.
0 commit comments