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

require pry-byebug in cli.rb which Pry will load in Pry.init #10

Merged
merged 1 commit into from
Oct 8, 2013

Conversation

lukebergen
Copy link
Contributor

I ran into an issue where I would get the error "ArgumentError: uncaught throw :breakout_nav" if I do this:

require 'pry'
# require 'pry-byebug'
binding.pry
puts "next statement"
[1] pry(main)> next

This pull request resolves that by using cli.rb to load pry-byebug before pry-core has a chance to call the un-extended Pry.start. I can follow up with more details if needed.

@deivid-rodriguez
Copy link
Owner

Hi man, thanks for this. I can confirm the issue but I tried your fix and I'm still getting the same error... Weird.

@lukebergen
Copy link
Contributor Author

That is strange. What version of pry are you running? I'm on 0.9.12.2. I'll dig in a little later and see if I can figure out what's happening.

@lukebergen
Copy link
Contributor Author

Hmm, I'm following the code path through and it should be working. The problem is that the load order goes like this:

require 'pry' #=> does nothing with plugins except run each plugin's cli.rb file via Pry.init which is run at the end of pry-core's pry_class.rb

binding.pry #=> Pretty much this just goes directly to Pry.start() and it's in pry.start that plugins are loaded (including doing the "require 'pry-byebug'").  So the bug happens because Pry.start() is run before pry-byebug is able to monkey-patch it.

Hmmm. It's possible that pry isn't finding the gem as modified by this PR. Can you see if it works if your Gemfile is like:

gem 'pry'
gem 'pry-byebug', github: "lukebergen/pry-byebug", branch: "load_on_init"

This way, Pry's PluginManager::Plugin.load_cli_options method should be able to find it.

@deivid-rodriguez
Copy link
Owner

Yeah, your explanation makes sense. I'll try this again as soon as I can and let you know! Thanks again.

@FND
Copy link

FND commented Oct 8, 2013

FWIW, I ran into the same issue and @lukebergen's branch appears to fix it for me.

deivid-rodriguez pushed a commit that referenced this pull request Oct 8, 2013
require pry-byebug in cli.rb which Pry will load in Pry.init
@deivid-rodriguez deivid-rodriguez merged commit 6b06191 into deivid-rodriguez:master Oct 8, 2013
@deivid-rodriguez
Copy link
Owner

Oh man, I totally forgot about this. Ok, two positives so I'm merging.

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

Successfully merging this pull request may close these issues.

3 participants