我有一个
ruby应用程序,使用反引号执行ant作为子进程.这没有任何问题.当我放置ant时,ruby等待子进程,ant,完全完成然后将输出打印到stdout.如何让ruby连续打印子进程的输出?
解决方法
你可以使用IO.popen.
IO.popen("ant") do |output| while line = output.gets do # ... maybe puts line? something more interesting? end end