-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
remove cli.rb to prevent loading of plugin #98
base: master
Are you sure you want to change the base?
Conversation
pry will load all cli.rb files from plugins, no matter when they are disabled or not and loading cli.rb will load all extensions and fully loading the plugin so `Pry.plugins['byebug'].disable!` does not work neither does `Pry.config.should_load_plugins = false` removing cli.rb fixes it
Hi @mikz, thanks for this. I think we need some more research to get this merged. Please refer to this comment for context and let me know! |
@deivid-rodriguez I see. So you need pry-byebug to monkeypatch Pry.start and the only place to do that is cli.rb ? Because everything else is loaded afterwards ? Uf. Would any of the Pry hooks be helpful there? |
I honestly don't know why this is needed, but removing it seems to cause a regression..., at least it did in the past 😞 So I prefer to leave it for now unless someone can make sure we don't regress. |
I can make sure that it does not regress. I just need to know why it tries to monkeypatch Pry.start. Would be enough just initializing the Byebug::PryProcessor when the plugin is initialized in https://github.com/pry/pry/blob/f5c97cac103a9f04b854ed5b117a8cc27c7e8dd6/lib/pry/pry_class.rb#L177 ? |
@mikz If you can get |
Ok. To drop the cli.rb I'd need to get rid of the monkeypatch too. From what I see it should be just fine. I'll try this to verify the regression: echo "require 'pry'; binding.pry; puts 'next statement'" > foo.rb
ruby foo.rb
# next |
Ideally we should add a regression test for posterity. But if you don't have time I guess we could live without it. |
@mikz Ping. Did you forget about this or just decided not to work on it? |
@deivid-rodriguez kind of both. IIRC there was more places to fix and I just did not have enough time. I'd like to fix this in the future, just not sure when I'll find time. |
Sounds good to me! |
pry will load all cli.rb files from plugins, no matter when they are disabled or not
and loading cli.rb will load all extensions and fully loading the plugin
so
Pry.plugins['byebug'].disable!
does not workneither does
Pry.config.should_load_plugins = false
removing cli.rb fixes it
I need to disable pry-byebug for some cases because of #69.
looks like it was introduced (https://github.com/deivid-rodriguez/pry-byebug/commits/77e1c046f89ae4b4dc255e6c5867415a20a78cec/lib/pry-debugger/cli.rb) to support pry-remote but that does not work much (#33)
Other pry plugins using cli.rb actually do something with the Pry::CLI which is not the case here. See https://github.com/pry/pry-exception_explorer/blob/540d7c9d139d6493083c3dc5c18315c1db100cc1/lib/pry-exception_explorer/cli.rb for an example.