Skip to content

Commit 1997811

Browse files
committed
Pass show_code: false to binding.irb if available
1 parent fb67374 commit 1997811

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/debug/thread_client.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ def wait_next_action_
987987
result = frame_eval(eval_src)
988988
when :irb
989989
begin
990-
result = frame_eval('binding.irb', binding_location: true)
990+
result = frame_eval(binding_irb, binding_location: true)
991991
ensure
992992
# workaround: https://github.com/ruby/debug/issues/308
993993
Reline.prompt_proc = nil if defined? Reline
@@ -1177,6 +1177,17 @@ def wait_next_action_
11771177
raise
11781178
end
11791179

1180+
private def binding_irb
1181+
return @binding_irb if defined?(@binding_irb)
1182+
1183+
require 'irb' # prelude's binding.irb doesn't have show_code option
1184+
@binding_irb = +'binding.irb'
1185+
if binding.method(:irb).parameters.include?([:key, :show_code])
1186+
@binding_irb << '(show_code: false)'
1187+
end
1188+
@binding_irb
1189+
end
1190+
11801191
def debug_event(ev, args)
11811192
DEBUGGER__.debug{
11821193
args = args.map { |arg| DEBUGGER__.safe_inspect(arg) }

0 commit comments

Comments
 (0)