Skip to content

Commit def2fd9

Browse files
committed
Update README.md
1 parent f2ee49f commit def2fd9

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

README.md

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,7 @@
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\necho 1\nsleep 1\necho 2 >&2\nsleep 1\necho 3\nsleep 1\necho 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\n2\n3\n4\n"
52-
53-
julia> merge(oc; colored = true)
54-
"1\n\e[31m2\n\e[39m3\n4\n"
55-
56-
julia> tail(oc; len = 2)
57-
"3\n4\n"
40+
julia> wait(oc)
5841

59-
julia> collect_stdout(oc)
60-
"1\n3\n4\n"
61-
62-
julia> collect_stderr(oc)
63-
"2\n"
42+
julia> String(take!(output))
43+
"1\n2\n3\n4\n"
6444
```

0 commit comments

Comments
 (0)