IO.popen() and system() in Ruby is sorely lacking several useful features, such as:
Python has a module "subprocess" which I was thinking about using as inspiration for a similar module in Ruby. Now to the questions:
Take a look at the standard Ruby library open3. This will give you access to stdin, stdout and stderr.
There is also an external project called open4, which allows you to get the exit status without using a magic variable name.
$?.exitstatus
system 'command 2>&1'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With