I have a ruby application that executes ant as a subprocess using backtick. This works without any problems. When I do puts ant
, ruby waits for the subprocess, ant, to finish completely and then prints the output to stdout. How do I get ruby to print the output from the subprocess continuously?
views:
523answers:
2
+4
A:
You could use IO.popen
.
IO.popen("ant") do |output|
while line = output.gets do
# ... maybe puts line? something more interesting?
end
end
Sarah Mei
2009-07-01 22:26:53