標準入力からデータを得る。

spidermonkeyで標準入力からデータを得る方法はreadline()だ。
一行づつなので再帰無名関数を使ってみたが、readlineの仕様上EOFまわりがうまく処理できない?

js> (function(){return (b=readline())?b+"\n"+arguments.callee():""})()
line1 a b c
line2 c d e
line3 f g h
line1 a b c
line2 c d e
line3 f g h