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

ruby-changes:3918

From: ko1@a...
Date: Sat, 9 Feb 2008 00:45:17 +0900 (JST)
Subject: [ruby-changes:3918] nobu - Ruby:r15408 (trunk, ruby_1_8): * lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than

nobu	2008-02-09 00:44:54 +0900 (Sat, 09 Feb 2008)

  New Revision: 15408

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/irb.rb
    branches/ruby_1_8/version.h
    trunk/ChangeLog
    trunk/lib/irb.rb
    trunk/version.h

  Log:
    * lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than
      SystemExit and SignalException.  [ruby-core:15359]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=15408&r2=15407&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=15408&r2=15407&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15408&r2=15407&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=15408&r2=15407&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/irb.rb?r1=15408&r2=15407&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/irb.rb?r1=15408&r2=15407&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15407)
+++ ChangeLog	(revision 15408)
@@ -1,3 +1,8 @@
+Sat Feb  9 00:44:52 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than
+	  SystemExit and SignalException.  [ruby-core:15359]
+
 Fri Feb  8 23:51:36 2008  Tanaka Akira  <akr@f...>
 
 	* missing/lgamma_r.c (lgamma_r): use smaller argument for sin function.
Index: lib/irb.rb
===================================================================
--- lib/irb.rb	(revision 15407)
+++ lib/irb.rb	(revision 15408)
@@ -148,10 +148,15 @@
             line.untaint
 	    @context.evaluate(line, line_no)
 	    output_value if @context.echo?
-	  rescue StandardError, ScriptError, Abort
-	    $! = RuntimeError.new("unknown exception raised") unless $!
-	    print $!.class, ": ", $!, "\n"
-	    if  $@[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && $!.class.to_s !~ /^IRB/
+	    exc = nil
+	  rescue Interrupt => exc
+	  rescue SystemExit, SignalException
+	    raise
+	  rescue Exception => exc
+	  end
+	  if exc
+	    print exc.class, ": ", exc, "\n"
+	    if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/
 	      irb_bug = true 
 	    else
 	      irb_bug = false
@@ -160,7 +165,7 @@
 	    messages = []
 	    lasts = []
 	    levels = 0
-	    for m in $@
+	    for m in exc.backtrace
 	      m = @context.workspace.filter_backtrace(m) unless irb_bug
 	      if m
 		if messages.size < @context.back_trace_limit
@@ -182,8 +187,7 @@
 	    print "Maybe IRB bug!!\n" if irb_bug
 	  end
           if $SAFE > 2
-            warn "Error: irb does not work for $SAFE level higher than 2"
-            exit 1
+            abort "Error: irb does not work for $SAFE level higher than 2"
           end
 	end
       end
Index: version.h
===================================================================
--- version.h	(revision 15407)
+++ version.h	(revision 15408)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-02-08"
+#define RUBY_RELEASE_DATE "2008-02-09"
 #define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080208
+#define RUBY_RELEASE_CODE 20080209
 #define RUBY_PATCHLEVEL 0
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 0
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 8
+#define RUBY_RELEASE_DAY 9
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 15407)
+++ ruby_1_8/ChangeLog	(revision 15408)
@@ -1,3 +1,8 @@
+Sat Feb  9 00:44:52 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than
+	  SystemExit and SignalException.  [ruby-core:15359]
+
 Fri Feb  8 15:09:21 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (xsystem): expand macros like as make.
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 15407)
+++ ruby_1_8/version.h	(revision 15408)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.8.6"
-#define RUBY_RELEASE_DATE "2008-02-08"
+#define RUBY_RELEASE_DATE "2008-02-09"
 #define RUBY_VERSION_CODE 186
-#define RUBY_RELEASE_CODE 20080208
+#define RUBY_RELEASE_CODE 20080209
 #define RUBY_PATCHLEVEL 5000
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 6
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 8
+#define RUBY_RELEASE_DAY 9
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/lib/irb.rb
===================================================================
--- ruby_1_8/lib/irb.rb	(revision 15407)
+++ ruby_1_8/lib/irb.rb	(revision 15408)
@@ -149,10 +149,15 @@
             line.untaint
 	    @context.evaluate(line, line_no)
 	    output_value if @context.echo?
-	  rescue StandardError, ScriptError, Abort
-	    $! = RuntimeError.new("unknown exception raised") unless $!
-	    print $!.class, ": ", $!, "\n"
-	    if  $@[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && $!.class.to_s !~ /^IRB/
+	    exc = nil
+	  rescue Interrupt => exc
+	  rescue SystemExit, SignalException
+	    raise
+	  rescue Exception => exc
+	  end
+	  if exc
+	    print exc.class, ": ", exc, "\n"
+	    if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/
 	      irb_bug = true 
 	    else
 	      irb_bug = false
@@ -161,7 +166,7 @@
 	    messages = []
 	    lasts = []
 	    levels = 0
-	    for m in $@
+	    for m in exc.backtrace
 	      m = @context.workspace.filter_backtrace(m) unless irb_bug
 	      if m
 		if messages.size < @context.back_trace_limit
@@ -183,8 +188,7 @@
 	    print "Maybe IRB bug!!\n" if irb_bug
 	  end
           if $SAFE > 2
-            warn "Error: irb does not work for $SAFE level higher than 2"
-            exit 1
+            abort "Error: irb does not work for $SAFE level higher than 2"
           end
 	end
       end

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

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