Skip to content

Commit

Permalink
Add a docstring showing supported usage of Pipe()
Browse files Browse the repository at this point in the history
It was brought up on discourse that this function doesn't have any docs.
  • Loading branch information
Keno committed Nov 23, 2017
1 parent fdf0883 commit baa9ff3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,22 @@ mutable struct Pipe <: AbstractPipe
in::PipeEndpoint # writable
out::PipeEndpoint # readable
end

"""
Construct an uninitialized Pipe object.
The appropriate end of the pipe will be automatically initialized if
the object is used in process spawning. This can be useful to easily
obtain references in process pipelines, e.g.:
```
julia> err = Pipe()
# After this `p` will be initialized and you may read `foo`'s
# stderr from the `err` pipe.
julia> spawn(pipeline(pipeline(`foo`, stderr=err), `cat`)
```
"""
Pipe() = Pipe(PipeEndpoint(), PipeEndpoint())
pipe_reader(p::Pipe) = p.out
pipe_writer(p::Pipe) = p.in
Expand Down

0 comments on commit baa9ff3

Please sign in to comment.