3 Answers
3

I think your problem is that when you pipe to your script STDIN will be the stream from your file, so when when you start IRB it will read from the same stream, but notice that it's at its end, and quit, just like it would when you type ctrl-D (which is a manual end of file signal).

You can reopen STDIN to read from the tty (i.e. the keyboard) like this:

STDIN.reopen(File.open('/dev/tty', 'r'))

but it looks a bit weird for me, I don't get the proper IRB promt. IRB works though.