| Path: | lib/open3.rb |
| Last Update: | Tue Nov 28 02:24:36 +0000 2006 |
open3.rb: Spawn a program like popen, but with stderr, too. You might also want to use this if you want to bypass the shell. (By passing multiple args, which IO#popen does not allow)
Usage:
require "open3"
stdin, stdout, stderr = Open3.popen3('nroff -man')
or:
include Open3
stdin, stdout, stderr = popen3('nroff -man')
popen3 can also take a block which will receive stdin, stdout and stderr as parameters. This ensures stdin, stdout and stderr are closed once the block exits.
Such as:
Open3.popen3('nroff -man') { |stdin, stdout, stderr| ... }