summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-08 15:44:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-08 15:44:54 +0000
commit39da1f68152faf491b32923c65410d942d5b45f8 (patch)
tree291f2623b4a02cd7a6207cae41e38a8a1ce89eeb /lib
parentae4025f3ade3c5c91ebf6ebed30191719419ddf7 (diff)
downloadruby-39da1f68152faf491b32923c65410d942d5b45f8.tar.gz
ruby-39da1f68152faf491b32923c65410d942d5b45f8.tar.xz
ruby-39da1f68152faf491b32923c65410d942d5b45f8.zip
* lib/irb.rb (IRB::Irb::eval_input): rescues Interrupt and other than
SystemExit and SignalException. [ruby-core:15359] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/irb.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/irb.rb b/lib/irb.rb
index 77a5f22eb..1274a15e9 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -148,10 +148,15 @@ module IRB
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 @@ module IRB
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 @@ module IRB
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