Hello,
I've been developing a library for communicating with sub processes via pipes, which is modelled somewhat after Python's Popen4 class [1] (although the semantics are slightly different).
I'm looking for some suggestions for a better name for the class (and any other comments, too).
I initially wrote this because I wanted to be able to do popen() type things without the shell getting in the way. You can pass arguments to sub processes without need for quoting etc.
Main features:
* Object-oriented interface
- procedural interface could easily be built on top, but haven't decided on best way yet
* Access to stdin, stdout and stderr independently
* Optional redirection of each of the above, to file/socket or /dev/null
* Can get exit status of child process (including signals)
* Send signals to child process
* Thread safe
For example:
Popen4.new('echo','$PATH') do |p|
puts p.stdout.readline #=> $PATH (and not the expansion of that env var!)
puts p.wait.exitstatus #=> 0
end
Any comments?
Thanks.
[1] http://www.python.org/doc/2.4/lib/module-popen2.html
open4.rb (8.57 KB)