I wrote a program (in Ruby) and it worked well. It prints out a few lines of text and then pause for a minute and then repeats the above.
It works well (in Mac OS X's terminal), but I noted that if I wanted to keep a record of the output, by using
ruby myscript.rb | tee record.txt
then the output won't be shown on the screen, until the output reaches a certain amount, perhaps a few kb. However, this could mean 5 or 10 minutes with nothing on the screen (and nothing in the file either if I press CTRL-C).
I could modify the program to flush the output, but I thought an app should be agnostic as to what is being used with the output to STDOUT. So can
tee be made to work well (perhaps with an option), or any other command could be used, or maybe it is an option of Bash or the Terminal app? Is there a way?