How to wait for system command to end

前端 未结 2 1772
渐次进展
渐次进展 2021-02-14 17:27

I\'m converting an XLS 2 CSV file with a system command in Ruby.

After the conversion I\'m processing the CSV files, but the conversion is still running when the progr

2条回答
  •  清歌不尽
    2021-02-14 17:59

    Try to use threads:

    command = Thread.new do
      system('ruby programm.rb') # long-long programm
    end
    command.join                 # main programm waiting for thread
    puts "command complete"
    

提交回复
热议问题