bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
854 stars 60 forks source link

REPL: piped input causes infinite loop #234

Open michaelficarra opened 12 years ago

michaelficarra commented 12 years ago
cat myInputFile | location/to/bin/rebl

The above causes the REPL to go into an infinite loop as it exits except when the input file contains an actual "end of transmission" character (ascii code 4). I believe it has something to do with trying to exit while Readline::readline is waiting for input. I've tried to fix it a number of ways so far and failed.

jhellerstein commented 12 years ago

Any insight as to whether there's something unusual in REBL here? This sounds like a generic issue with Readline::readline to be worked around/with. If that's so, perhaps we can isolate a little 5-line example program that illustrates/isolates the problem?

michaelficarra commented 12 years ago

It certainly could be a generic Readline::readline issue. I can easily reproduce #151 using Readline::readline in irb, but after trying for 15 minutes or so, I can't reproduce this issue in irb. I don't think REBL is doing anything particularly out of the ordinary here, though. I tried adding logging output in the vicinity of the loop construct and didn't see any output, but I don't think that's a trustworthy result since the program is already in a partially-exited state (which may no longer be able to output to stdout) when it goes into its infinite loop.