Issue #14245 has been updated by shugo (Shugo Maeda).


matz (Yukihiro Matsumoto) wrote:
> Agreed for mostly security reasons.

Is this incompatibility acceptable in Ruby 2.6?


----------------------------------------
Feature #14245: Add File.read etc.
https://bugs.ruby-lang.org/issues/14245#change-71008

* Author: shugo (Shugo Maeda)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Some people use File.open without knowing that it's defined in IO and pipes can be opened.

```
p File.read("|echo hello") #-> "hello"
```

How about to add File.read, File.binread, File.foreach etc. (similar version to File.open)?
Code like File.read(filename) is considered to have no intention to open pipes.

Implementation by prelude.rb is suggested by normalperson in #14239:

> I like that idea, I've been rewriting some stuff to use
> "File.open(filename, &:read)" instead of IO.read.
> 
> Now, can we implement these new singleton methods in
> prelude.rb instead of writing in C? :)




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>