Project

General

Profile

Actions

Bug #3843

closed

ruby -r tracer prog.rb no longer tracers prog.rb

Added by pragdave (Dave Thomas) about 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
1.9.2
Backport:
[ruby-core:32448]

Description

=begin
The problem appears to be at the end of tracer.rb:

if $0 == FILE

direct call

$0 = ARGV[0]
ARGV.shift
Tracer.on
require $0
elsif caller.size <= 1
Tracer.on
end

IN 1.9.2, caller() at this point is 2 deep:

["internal:lib/rubygems/custom_require:29:in require'", "<internal:lib/rubygems/custom_require>:29:in require'"]

The following change seems to fix it, but it feels a little hacky..

if $0 == FILE

direct call

$0 = ARGV[0]
ARGV.shift
Tracer.on
require $0
elsif caller.size <= 2 && caller.all? {|place| place =~ /custom_require/}
Tracer.on
end

Dave
=end


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #3749: -rtracer doesn't trace anymoreClosedko1 (Koichi Sasada)08/26/2010Actions
Actions

Also available in: Atom PDF

Like0
Like0