Execute external program in ruby and wait for its execution

前端 未结 3 1051
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 10:53

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:33

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

提交回复
热议问题