lib/tracerr.rb in backtracer-0.2.0 vs lib/tracerr.rb in backtracer-0.2.1
- old
+ new
@@ -117,20 +117,20 @@
for p in @filters
return unless p.call event, file, line, id, binding, klass
end
- saved_crit = Thread.critical
- Thread.critical = true
+ (saved_crit = Thread.critical) rescue nil
+ (Thread.critical = true) rescue nil
stdout.printf("#%d:%s:%d:%s:%s: %s",
get_thread_no,
file,
line,
klass || '',
EVENT_SYMBOL[event],
get_line(file, line))
- Thread.critical = saved_crit
+ (Thread.critical = saved_crit) rescue nil
end
Single = new
def Tracer.on
if block_given?
@@ -153,16 +153,16 @@
end
end
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
-
+puts caller(0).size
if $0 == __FILE__
# direct call
$0 = ARGV[0]
ARGV.shift
Tracer.on
require $0
-elsif caller(0).size == 1
+elsif caller(0).size <= 2
Tracer.on
end