标签: ruby-on-rails command-line-interface
我从函数中解除了cap任务和其他命令行脚本,但我想知道为我显示实时日志的最佳方法是什么。
答案 0 :(得分:2)
我最终得到了此代码段中的解决方案
STDOUT.sync = true IO.popen(command+" 2>&1") do |pipe| pipe.sync = true while str = pipe.gets puts "-> "+str end end