diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-03-11 08:31:53 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-03-11 08:31:53 +0000 |
commit | 58226f400e2f41777b95940eb2202dd9db11d3f3 (patch) | |
tree | 364e1850f37744c35ca145d28e34c1ca9d2cf6cc /eval.c | |
parent | f2ba46eefaacbd786e0cd4bff8ed904008c15291 (diff) |
* eval.c (error_handle): no message when exiting by signal.
* eval.c (ruby_cleanup): re-send signal. [ruby-dev:30516]
* eval.c (rb_thread_interrupt): instantiate SignalException.
* eval.c (rb_thread_signal_raise): now takes signal number instead
of signal name.
* intern.h (rb_thread_signal_raise, ruby_default_signal): prototypes.
* signal.c (esignal_init): takes a signal number and an optional
signal name.
* signal.c (interrupt_init): pass SIGINT always.
* signal.c (ruby_default_signal): invoke system default signal
handler.
* signal.c (rb_signal_exec, trap): handle SIGTERM. [ruby-dev:30505]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@12027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -1492,6 +1492,9 @@ error_handle(ex) if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) { status = sysexit_status(ruby_errinfo); } + else if (rb_obj_is_instance_of(ruby_errinfo, rb_eSignal)) { + /* no message when exiting by signal */ + } else { error_print(); } @@ -1579,9 +1582,15 @@ ruby_cleanup(ex) ruby_finalize_1(); POP_TAG(); - if (err && rb_obj_is_kind_of(err, rb_eSystemExit)) { - VALUE st = rb_iv_get(err, "status"); - return NUM2INT(st); + if (err) { + if (rb_obj_is_kind_of(err, rb_eSystemExit)) { + VALUE st = rb_iv_get(err, "status"); + return NUM2INT(st); + } + else if (rb_obj_is_kind_of(err, rb_eSignal)) { + VALUE sig = rb_iv_get(err, "signo"); + ruby_default_signal(NUM2INT(sig)); + } } return ex; } @@ -10155,7 +10164,6 @@ static VALUE th_raise_exception; static NODE *th_raise_node; static VALUE th_cmd; static int th_sig, th_safe; -static char *th_signm; #define RESTORE_NORMAL 1 #define RESTORE_FATAL 2 @@ -10261,7 +10269,7 @@ rb_thread_switch(n) rb_raise_jump(th_raise_exception); break; case RESTORE_SIGNAL: - rb_raise(rb_eSignal, "SIG%s", th_signm); + rb_thread_signal_raise(th_sig); break; case RESTORE_EXIT: ruby_errinfo = th_raise_exception; @@ -12262,13 +12270,15 @@ rb_thread_interrupt() void rb_thread_signal_raise(sig) - char *sig; + int sig; { - if (sig == 0) return; /* should not happen */ rb_thread_critical = 0; if (curr_thread == main_thread) { + VALUE argv[1]; + rb_thread_ready(curr_thread); - rb_raise(rb_eSignal, "SIG%s", sig); + argv[0] = INT2FIX(sig); + rb_exc_raise(rb_class_new_instance(1, argv, rb_eSignal)); } rb_thread_ready(main_thread); if (!rb_thread_dead(curr_thread)) { @@ -12276,7 +12286,7 @@ rb_thread_signal_raise(sig) return; } } - th_signm = sig; + th_sig = sig; curr_thread = main_thread; rb_thread_restore_context(curr_thread, RESTORE_SIGNAL); } |