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
Making the streams interactive for jruby #40
Conversation
About the PR: So consider the implementation as a monkey patch on jruby... |
Apparently this has been a known problem in jruby since 2007. I have commented with reference to this PR. The bug report states that it is fixed in jruby-1.7.1 |
Making the streams interactive for jruby
Thanks. I agree it's a bit nasty having to dig into JRuby internals like this, but I guess it's better than what we had. |
Thanks... Over at aruba we would appreciate if a new gem would be release with these two patches (the other one being flushing)... Our jruby CI build depends on them... |
Just pushed v0.3.6! |
Looks like the new spec failed on Travis: https://travis-ci.org/#!/jarib/childprocess/jobs/2822664 Can we get rid of the sleep() calls and rather poll for the expected output? |
Please also include #42 before making a new gem release... |
I don't know how to get rid of the sleep... I'll take a look at the travis in an hour or so... Maybe Travis needs a longer sleep... |
I think the problem is in the output pumps: The pumps are polling (and sleeps a bit everytime). I think the output pumps could be rewritten to be non-polling and using blocking read methods on the |
That sounds like a good idea. Feel free to give it a shot if you know a way to do the pumps without polling. The spec failure however happened on Rubinius, so the spec should be changed to poll instead of sleeping anyway. I'll fix the spec. |
For the spec, the only thing I can get working reliably is this: https://gist.github.com/3904922 WDYT? |
I also tried e.g.: wait_until { out_receiver.read.should == "hello\n" } That seems to work for MRI but not JRuby, which consistently times out. I'll push the spec change, but perhaps we can use the above approach instead if we get rid of polling in the pumps. |
That's better: https://travis-ci.org/#!/jarib/childprocess/builds/2823539 |
If you do this: https://gist.github.com/390492 The "interactivity" is not very clear... Part of the intention with the test was to validate that continous reading from the output was possible... I think the example as it is now (reading the whole file) does not illustrate that. |
I'd love to have a spec that does illustrate this better, but it needs to be robust and not have intermittent failures. |
I understand... |
This PR solves a problem regarding interactive input stream on jruby.
Please review and provide feedback...