I assume the doc’s are “just wrong” when they say you can access an
IO.popen with any mode you’d like?
http://ruby-doc.org/core/classes/IO.html#M002242
IO.popen(“gocr”, “rw”)
ArgumentError: invalid access mode rw
Is this expected?
-r
I assume the doc’s are “just wrong” when they say you can access an
IO.popen with any mode you’d like?
http://ruby-doc.org/core/classes/IO.html#M002242
IO.popen(“gocr”, “rw”)
ArgumentError: invalid access mode rw
Is this expected?
-r
Roger P. wrote:
I assume the doc’s are “just wrong” when they say you can access an
IO.popen with any mode you’d like?IO.popen(“gocr”, “rw”)
ArgumentError: invalid access mode rwIs this expected?
Yes. It doesn’t say “any mode you’d like”; it says “any of the modes
listed in the description for class IO” - that is, any valid mode
You’re probably looking for mode “r+” or “a+”
Hello Roger,
IO.popen(“gocr”, “rw”)
ArgumentError: invalid access mode rw
When I want to read and write from the IO.popen’ed command, I use
IO.popen(cmd, “r+”)
but I do not remember from which source I found I had to use “r+”
rather than the more expected “rw”
Cheers,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs