How to capture the output of a call to Kernel.system

I suspect that this is an extremely simple question to answer.

How do you capture the output of a system call?

For example, if I do this:

x = system(“date”)
Thu Jun 18 13:00:00 CDT 2009
=> true

x
=> true

I would like to capture the output of the date command. How do I do it?

Thanks,
Wes

On Thu, Jun 18, 2009 at 2:01 PM, Wes G.[email protected] wrote:

=> true

I would like to capture the output of the date command. Â How do I do it?

x = date

if you need to capture more than just stdout, i recommend the systemu
gem.

best,
michael guterl

2009/6/18 Michael G. [email protected]:

x
=> true

I would like to capture the output of the date command. How do I do it?

x = date

if you need to capture more than just stdout, i recommend the systemu gem.

There’s also IO.popen and Open3.popen which are part of the standard
library IIRC.

Kind regards

robert