Ruby1.9 - require "debug" and output when stdout is not a terminal?

Try this:

cat >> test.rb << EOF
require "debug"
a = 10
a = 10
a = 10
a = 10

Then run it this way:

ruby test.rb | cat

now when the debug prompt pops up type
p "dummy"

and dummy is printed after leaving the debug prompt.
Is there a way to make it behave the ruby-1.8 way - print it instantly?

I used this kind of output in Vim REPL completion.

Yes - I know I should implement kind of true debugger interface...

Marc Weber