popen3(*cmd) public

Open stdin, stdout, and stderr streams and start external executable. Non-block form:

require 'open3'

stdin, stdout, stderr = Open3.popen3(cmd)

Block form:

require 'open3'

Open3.popen3(cmd) { |stdin, stdout, stderr| ... }

The parameter cmd is passed directly to Kernel#exec.

popen3 is like system in that you can pass extra parameters, and the strings won’t be mangled by shell expansion.

stdin, stdout, stderr = Open3.popen3('identify', '/weird path/with spaces/and "strange" characters.jpg')
result = stdout.read
Show source
Register or log in to add new notes.