Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL: piped input causes infinite loop #234

Open
michaelficarra opened this issue Aug 18, 2011 · 2 comments
Open

REPL: piped input causes infinite loop #234

michaelficarra opened this issue Aug 18, 2011 · 2 comments

Comments

@michaelficarra
Copy link
Contributor

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.

  • Tried writing an end of transmission or newline character to $stdin so that Readline::readline could read it off, but it fails because $stdin is opened as read-only. Can't reopen $stdin as read-write.
  • Tried finding the child process that Readline::readline is using because killing that successfully exits the REPL. No luck, there's no cross-platform way to find child processes.
  • Looked into creating a writeable proxy IO object that Readline::readline will read from so we can forward $stdin and also write to it, but there's no declarative or event-driven way to forward $stdin to the proxy IO object.
@jhellerstein
Copy link
Member

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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants