Ruby Programming/Standard Library/Open3

From Wikibooks, open books for an open world
< Ruby Programming
Jump to: navigation, search

You’ll notice there’s IO.popen but not IO.popen3. Do a require 'open3' to get that one (like Open3.popen3).

The difference between popen and popen3 is that popen3 provides you access to the input and output streams of the process. Note also that if one of the pipes passed to you get written to (by the process) a lot, it might block, so you'll need to read from those streams.