Execute external program in ruby and wait for its execution

前端 未结 3 1542
我在风中等你
我在风中等你 2021-02-20 11:15

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 wit

3条回答
  •  不知归路
    2021-02-20 11:47

    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..

提交回复
热议问题