mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* signal.c (esignal_signo): fix SignalException#signo which returned
nil absolutely. * signal.c (esignal_init): always prepend "SIG" to a string that is returned by SignalException#signm. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5e6fc71d96
commit
bd9030438e
2 changed files with 23 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Fri May 30 22:28:03 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* signal.c (esignal_signo): fix SignalException#signo which returned
|
||||||
|
nil absolutely.
|
||||||
|
|
||||||
|
* signal.c (esignal_init): always prepend "SIG" to a string that is
|
||||||
|
returned by SignalException#signm.
|
||||||
|
|
||||||
Fri May 30 22:17:39 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
Fri May 30 22:17:39 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* test/ruby/test_argf.rb: rename a conflicting method name.
|
* test/ruby/test_argf.rb: rename a conflicting method name.
|
||||||
|
|
19
signal.c
19
signal.c
|
@ -253,9 +253,7 @@ esignal_init(int argc, VALUE *argv, VALUE self)
|
||||||
if (!signo) {
|
if (!signo) {
|
||||||
rb_raise(rb_eArgError, "unsupported name `SIG%s'", signm);
|
rb_raise(rb_eArgError, "unsupported name `SIG%s'", signm);
|
||||||
}
|
}
|
||||||
if (SYMBOL_P(sig)) {
|
sig = rb_sprintf("SIG%s", signm);
|
||||||
sig = rb_str_new2(signm);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rb_call_super(1, &sig);
|
rb_call_super(1, &sig);
|
||||||
rb_iv_set(self, "signo", INT2NUM(signo));
|
rb_iv_set(self, "signo", INT2NUM(signo));
|
||||||
|
@ -263,6 +261,19 @@ esignal_init(int argc, VALUE *argv, VALUE self)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* signal_exception.signo => num
|
||||||
|
*
|
||||||
|
* Returns a signal number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
esignal_signo(VALUE self)
|
||||||
|
{
|
||||||
|
return rb_iv_get(self, "signo");
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
interrupt_init(int argc, VALUE *argv, VALUE self)
|
interrupt_init(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
|
@ -1070,7 +1081,7 @@ Init_signal(void)
|
||||||
rb_define_module_function(mSignal, "list", sig_list, 0);
|
rb_define_module_function(mSignal, "list", sig_list, 0);
|
||||||
|
|
||||||
rb_define_method(rb_eSignal, "initialize", esignal_init, -1);
|
rb_define_method(rb_eSignal, "initialize", esignal_init, -1);
|
||||||
rb_attr(rb_eSignal, rb_intern("signo"), 1, 0, 0);
|
rb_define_method(rb_eSignal, "signo", esignal_signo, 0);
|
||||||
rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
|
rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
|
||||||
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
|
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue