Unverified Commit 1abff3f2 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #3957 from take-cheeze/fix_io_read

Pass same mode parameter to `IO.sysopen` and `IO.open` in `IO.read`.
parents ceeb8c05 92641248
...@@ -93,8 +93,9 @@ class IO ...@@ -93,8 +93,9 @@ class IO
if path[0] == "|" if path[0] == "|"
io = IO.popen(path[1..-1], (opt[:mode] || "r")) io = IO.popen(path[1..-1], (opt[:mode] || "r"))
else else
fd = IO.sysopen(path) mode = opt[:mode] || "r"
io = IO.open(fd, opt[:mode] || "r") fd = IO.sysopen(path, mode)
io = IO.open(fd, mode)
end end
io.seek(offset) if offset > 0 io.seek(offset) if offset > 0
str = io.read(length) str = io.read(length)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment