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

conflict between HighLine and Mechanize #2

Closed
bleything opened this issue Sep 1, 2009 · 2 comments
Closed

conflict between HighLine and Mechanize #2

bleything opened this issue Sep 1, 2009 · 2 comments

Comments

@bleything
Copy link

I'm not really sure what's happening here:

#!/usr/bin/env ruby -w

require 'rubygems'
require 'mechanize'
require 'highline'
require 'highline/import'

WWW::Mechanize.new.get "http://gooogle.com"
ask "wha?"

yields:

wha?
/Library/Ruby/Gems/1.8/gems/highline-1.5.1/lib/highline.rb:603:in `get_line': The input stream is exhausted. (EOFError)
    from /Library/Ruby/Gems/1.8/gems/highline-1.5.1/lib/highline.rb:624:in `get_response'
    from /Library/Ruby/Gems/1.8/gems/highline-1.5.1/lib/highline.rb:218:in `ask'
    from /tmp/foo.rb:7

I'm at a loss here :(

@JEG2
Copy link
Owner

JEG2 commented Sep 1, 2009

This is a known issue caused by some oddities in Ruby's threading model (Mechanize uses threads). We did a bunch of experiments when we first spotted it and the behavior can change depending on whether or not Ruby was compiled with pthread support and whether or not any thread had been started before HighLine was first invoked. It's pretty odd stuff and I have reported it to the core team.

We did add an option to help with this though. You can shut off HighLine's EOF tracking with:

HighLine.track_eof = false

That should eliminate the error for you.

@bleything
Copy link
Author

Oh wow. That's brutal. I googled around a bit but didn't find anything.

I'm glad to hear that option is present, I'll check it out. Thanks, James!

abinoam added a commit that referenced this issue Jul 6, 2015
This issue was closed.
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