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?
You could use IO.popen
.
IO.popen("ant") do |output|
while line = output.gets do
# ... maybe puts line? something more interesting?
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With