Trying to call binding.pry in a Hanami Interactor/Controller #call method results in nothing showing up and needing to use Ctrl+C to stop the execution of code. You can workaround this limitation by using:
module Web::Controllers::Home
class Index
include Web::Action
def call(params)
_call(params)
end
def _call(params)
# Code that normally would go directly in #call and you need to debug
binding.pry
end
end
end
As a test case, I prepared a small Hanami project showing the bug:
hanami_pry_bug.zip
The problematic code is in apps/web/controllers/home/index.rb, while the test is in spec/web/features/visit_home_spec.rb. You can reproduce the bug simply by running:
$ bundle install
$ HANAMI_ENV=test bundle exec hanami db prepare
$ bundle exec rake test
Tested with pry 0.10.4 and current master (commit 3743228), ruby 2.3.0 and hanami 1.0 (however it also occurs in older versions of hanami, like 0.9).
BTW, the problem does not seem related to Hanami, because https://github.com/deivid-rodriguez/byebug works.
Related issues: hanami/hanami#205 and #1471
Trying to call
binding.pryin a Hanami Interactor/Controller #call method results in nothing showing up and needing to useCtrl+Cto stop the execution of code. You can workaround this limitation by using:As a test case, I prepared a small Hanami project showing the bug:
hanami_pry_bug.zip
The problematic code is in
apps/web/controllers/home/index.rb, while the test is inspec/web/features/visit_home_spec.rb. You can reproduce the bug simply by running:Tested with
pry0.10.4 and current master (commit 3743228),ruby2.3.0 andhanami1.0 (however it also occurs in older versions ofhanami, like 0.9).BTW, the problem does not seem related to Hanami, because https://github.com/deivid-rodriguez/byebug works.
Related issues: hanami/hanami#205 and #1471