Alex Rivera | Logout

Execute external program in ruby and wait for its execution

Asked 2011-07-11T11:36:14.630
10

How do I start an external program (like an excel sheet) from ruby and wait for its execution resp. termination before continuing.

I know I can start the excel sheet with

system 'start excel "my/path/to/the/sheet"' 

but using this will only start the sheet and then continues.

Edit
Report

1 Answer

3

Do not use start! The command system will wait for the result. In Windows prompt the start command starts programs asynchronously.

system 'excel yout/path/sheet'

Or you can use %x too, if you want an array as result :

%x{ ls }

If you have the start command in your command, %x will wait for the output anyway..

answered 2011-07-11T11:39:37.777

Your Answer