Hi,
I want to capture the output from a program but still have it print to
STDOUT.
I tried
r = []
IO.popen(“mycmd”) do |pipe|
while (line = pipe.gets)
r << line
STDOUT.puts line
end
end
but the output will only come after the command has finished running.
This doesn’t
work here since the command runs for very long and the user will want
the output.
Is there a pure-Ruby way (that works on Windows!) for capturing the
output of
a command without “disturbing” its normal output to STDOUT?
Sorry if this is very basic but I have a windows background…
Regards,
Karsten