Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advertise readchomp function more #37806

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Note that Julia does not convert the endianness for you. Use [`ntoh`](@ref) or

read(io::IO, String)

Read the entirety of `io`, as a `String`.
Read the entirety of `io`, as a `String` (see also [`readchomp`](@ref)).

# Examples
```jldoctest
Expand Down
9 changes: 5 additions & 4 deletions doc/src/manual/running-external-programs.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ The `hello` is the output of the `echo` command, sent to [`stdout`](@ref). The r
returns `nothing`, and throws an [`ErrorException`](@ref) if the external command fails to run
successfully.

If you want to read the output of the external command, [`read`](@ref) can be used instead:
If you want to read the output of the external command, [`read`](@ref) or [`readchomp`](@ref)
can be used instead:

```jldoctest
julia> a = read(`echo hello`, String)
julia> read(`echo hello`, String)
"hello\n"

julia> chomp(a) == "hello"
true
julia> readchomp(`echo hello`)
"hello"
```

More generally, you can use [`open`](@ref) to read from or write to an external command.
Expand Down