From 6adc5899b34c24dbd4d63ef4d4724b29ef907206 Mon Sep 17 00:00:00 2001 From: Tony Novak Date: Thu, 21 Sep 2023 16:01:23 -0400 Subject: [PATCH] Don't enable the tracer when stopped by pry-rescue See https://github.com/ConradIrwin/pry-rescue/issues/124 --- pry-byebug doesn't play nicely with pry-rescue. Detect if we're in a rescued exception, and if so, use pry without byebug. --- lib/pry-byebug/pry_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pry-byebug/pry_ext.rb b/lib/pry-byebug/pry_ext.rb index cd37b02..fdb7cab 100644 --- a/lib/pry-byebug/pry_ext.rb +++ b/lib/pry-byebug/pry_ext.rb @@ -8,7 +8,7 @@ class << Pry::REPL def start_with_pry_byebug(options = {}) target = options[:target] - if target.is_a?(Binding) && PryByebug.file_context?(target) + if target.is_a?(Binding) && PryByebug.file_context?(target) && !options[:hooks]&.hook_exists?(:before_session, :save_captured_exception) Byebug::PryProcessor.start unless ENV["DISABLE_PRY"] else # No need for the tracer unless we have a file context to step through