ConradIrwin / pry-rescue

Start a pry session whenever something goes wrong.
MIT License
852 stars 49 forks source link

pry-rescue doesn't work correctly if pry-byebug is loaded #71

Open abicky opened 10 years ago

abicky commented 10 years ago

pry-byebug overwrites Pry.start and pry-rescue doesn't work correctly if pry-byebug is loaded, as you can see below:

% bundle exec pry
[1] pry(main)> require './a.rb'
=> true
[2] pry(main)> foo
RuntimeError: two
from /path/to/a.rb:4:in `rescue in foo'
[3] pry(main)> cd-cause

From: /path/to/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/pry-rescue-1.4.1/lib/pry-rescue.rb @ line 207 PryRescue.with_program_name:

    202: def with_program_name name
    203:   before = $PROGRAM_NAME
    204:   $PROGRAM_NAME = name
    205:   yield
    206: ensure
 => 207:   $PROGRAM_NAME = before
    208: end

[1] pry(PryRescue)>

My Gemfile.lock is here:

GEM
  remote: https://rubygems.org/
  specs:
    byebug (3.4.0)
      columnize (~> 0.8)
      debugger-linecache (~> 1.2)
      slop (~> 3.6)
    coderay (1.1.0)
    columnize (0.8.9)
    debugger-linecache (1.2.0)
    interception (0.5)
    method_source (0.8.2)
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-byebug (2.0.0)
      byebug (~> 3.4)
      pry (~> 0.10)
    pry-rescue (1.4.1)
      interception (>= 0.5)
      pry
    slop (3.6.0)

PLATFORMS
  ruby

DEPENDENCIES
  pry
  pry-byebug
  pry-rescue
edude03 commented 9 years ago

I just ran into the same issue, is there a fix for this?

neumachen commented 9 years ago

Anyone fixed this?

hakunin commented 9 years ago

Same problem here. Any workarounds?

neumachen commented 9 years ago

I downgraded especially to 3.1

hakunin commented 9 years ago

Thanks for the tip. Just realised I don't have byebug in the mix at the moment :) will log as a new issue.

gerrywastaken commented 9 years ago

There are many issues like this caused by the fact that pry-byebug changes pry so that it advances to the next line after a breakpoint is hit. See the discussion here: https://github.com/deivid-rodriguez/pry-byebug/issues/45

mmacedo commented 9 years ago

@hakunin @magicalbanana Other than downgrading (3.1 is the latest version of pry-byebug, I figure @magicalbanana meant 3.0.1 or from 3.1, I am not sure), I found an alternative workaround: disabling this annoying auto-loading of plugins and then loading it manually (now I can use the executable). I'd like to register it here for people that like me arrive here unaware of this "convenience".

skull-squadron commented 9 years ago

Here's a patched pry 0.10.2pre to add more config tweaks (i.e., blacklisting plugins) via env vars and how to get it.

cmrd-senya commented 8 years ago

Works for me with pry-byebug 3.4.0 and pry-rescue 1.4.4.

altV commented 8 years ago

I have pry-byebug 3.4.0 and pry-rescue 1.4.4 - and I have the same problem with ruby 2.3.1

parreirat commented 7 years ago

Still getting this as of 26/01/2017, any news?