I am trying to run a system command (rspec) and print its output to the terminal in real time and in colour, but I also want to capture its printed output in a string to use later.
At the moment it looks something like this:
cmd = "rspec #{ARGV.join(' ')}"
system cmd
raw = `#{cmd}`
This works, but since RSpec takes several seconds to complete, doubling that time is not insignificant. Is there any way to keep the system call printing to the terminal, but also have its output available for capture?
print raw = `#{cmd}`?