On Dec 29, 2009, at 7:11 PM, John Smith wrote:

> I have the following hypothetical script that requires arguments to =
run.
> The command line execution looks like this:
>=20
> 'ruby distance_traveled.rb 60 2.5'
>=20
> The output would be the following:
>=20
> 'You have traveled a distance of 150 miles.'
>=20
>=20
> How would I run the above execution from inside another script, and
> capture the output above (the 150 miles portion at least)?
>=20
> Thanks in advance!
> --=20
> Posted via http://www.ruby-forum.com/.
>=20


I've faced an exactly same problem when was testing command line =
utilities, by capturing an output and comparing it with expected one. =
Here is a gem for it:

http://github.com/fkocherga/cmd_line_test=20

You may look on running and capturing code there.=20

--
Fedor Kocherga
http://sidenotes.kocherga.info/