Skip to content

Commit

Permalink
added documentation for read command methods (#28748)
Browse files Browse the repository at this point in the history
* added documentation for read command methods

* fixed docs

(cherry picked from commit f6c48eb)
  • Loading branch information
ExpandingMan authored and KristofferC committed Sep 8, 2018
1 parent 79a7efd commit 2747c9c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions base/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,23 @@ function open(f::Function, cmds::AbstractCmd, args...)
return ret
end

"""
read(command::Cmd)
Run `command` and return the resulting output as an array of bytes.
"""
function read(cmd::AbstractCmd)
procs = open(cmd, "r", devnull)
bytes = read(procs.out)
success(procs) || pipeline_error(procs)
return bytes
end

"""
read(command::Cmd, String)
Run `command` and return the resulting output as a `String`.
"""
read(cmd::AbstractCmd, ::Type{String}) = String(read(cmd))

"""
Expand Down

0 comments on commit 2747c9c

Please sign in to comment.