[前][次][番号順一覧][スレッド一覧]

ruby-changes:58895

From: aycabta <ko1@a...>
Date: Sun, 24 Nov 2019 23:15:27 +0900 (JST)
Subject: [ruby-changes:58895] 745ab16818 (master): Disable tracer ext of IRB when tracer doesn't found

https://git.ruby-lang.org/ruby.git/commit/?id=745ab16818

From 745ab168185fc8f3c9d9dbd3a2355738776aee6d Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 24 Nov 2019 22:42:08 +0900
Subject: Disable tracer ext of IRB when tracer doesn't found


diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb
index 200f77e..a1eeff3 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -9,7 +9,21 @@ https://github.com/ruby/ruby/blob/trunk/lib/irb/ext/tracer.rb#L9
 #
 #
 #
-require "tracer"
+begin
+  raise LoadError
+  require "tracer"
+rescue LoadError
+  $stderr.puts "Tracer extension of IRB is enabled but tracer gem doesn't found."
+  module IRB
+    TracerLoadError = true
+    class Context
+      def use_tracer=(opt)
+        # do nothing
+      end
+    end
+  end
+  return # This is about to disable loading below
+end
 
 module IRB
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]