From cccfa4edeed8f7988eb103e9f6f8ede327dc7771 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 18 Jul 2000 06:00:45 +0000 Subject: matz git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ eval.c | 39 +++++++++++++++++++-------------------- lib/complex.rb | 2 -- lib/debug.rb | 1 + lib/ping.rb | 2 +- lib/weakref.rb | 4 ++-- parse.y | 2 +- sample/cal.rb | 9 ++++----- sample/goodfriday.rb | 8 ++++---- 9 files changed, 39 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50dd71edd..35a1bea35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Jul 18 14:58:30 2000 Yukihiro Matsumoto + + * eval.c (ruby_options): should treat SystemExit etc. properly. + + * parse.y (yycompile): should check compile_for_eval, not + ruby_in_eval. + Mon Jul 17 04:29:50 2000 Minero Aoki * lib/mkmf.rb: converts extention of $objs into $OBJEXT. diff --git a/eval.c b/eval.c index 70051cab9..24a729838 100644 --- a/eval.c +++ b/eval.c @@ -1002,26 +1002,6 @@ ruby_init() ruby_scope = top_scope; } -void -ruby_options(argc, argv) - int argc; - char **argv; -{ - int state; - - PUSH_TAG(PROT_NONE) - if ((state = EXEC_TAG()) == 0) { - ruby_process_options(argc, argv); - } - POP_TAG(); - if (state) { - trace_func = 0; - tracing = 0; - error_print(); - exit(1); - } -} - static VALUE eval_node(self) VALUE self; @@ -1099,6 +1079,25 @@ error_handle(ex) return ex; } +void +ruby_options(argc, argv) + int argc; + char **argv; +{ + int state; + + PUSH_TAG(PROT_NONE) + if ((state = EXEC_TAG()) == 0) { + ruby_process_options(argc, argv); + } + POP_TAG(); + if (state) { + trace_func = 0; + tracing = 0; + exit(error_handle(state)); + } +} + void ruby_run() { diff --git a/lib/complex.rb b/lib/complex.rb index 56dd040ac..733e4530e 100644 --- a/lib/complex.rb +++ b/lib/complex.rb @@ -500,5 +500,3 @@ module Math module_function :atanh! end - - diff --git a/lib/debug.rb b/lib/debug.rb index d20d1ebbf..71fe83047 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -578,6 +578,7 @@ EOHELP end def excn_handle(file, line, id, binding) + p $! if $!.type <= SystemExit set_trace_func nil exit diff --git a/lib/ping.rb b/lib/ping.rb index 065b1d230..48657818c 100644 --- a/lib/ping.rb +++ b/lib/ping.rb @@ -38,9 +38,9 @@ #=end require 'timeout' +require "socket" module Ping - require "socket" def pingecho(host, timeout=5, service="echo") begin timeout(timeout) do diff --git a/lib/weakref.rb b/lib/weakref.rb index 3307a2e5a..9e510d6f1 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -43,8 +43,8 @@ class WeakRef