mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* signal.c (trap): return "DEFAULT" and "IGNORE" respectively for
previous sighandler SIG_DFL and SIG_IGN. [ruby-talk:67860] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cd6f64e37c
commit
80a97f173f
3 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Mar 25 23:26:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* signal.c (trap): return "DEFAULT" and "IGNORE" respectively for
|
||||
previous sighandler SIG_DFL and SIG_IGN. [ruby-talk:67860]
|
||||
|
||||
Tue Mar 25 12:24:15 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_yield_0): call avalue_to_mrhs() to assign block
|
||||
|
|
|
@ -248,6 +248,11 @@ f = lambda {|r,*l| test_ok([] == r); test_ok([1] == l)}
|
|||
f.call([], *[1])
|
||||
f.yield([], *[1])
|
||||
|
||||
a = [42,55]
|
||||
lambda{|x| test_ok([42,55] == x)}.call(a)
|
||||
lambda{|x,| test_ok([42,55] == x)}.call(a)
|
||||
lambda{|*x| test_ok([[42,55]] == x)}.call(a)
|
||||
|
||||
a,=*[1]
|
||||
test_ok(a == 1)
|
||||
|
||||
|
|
16
signal.c
16
signal.c
|
@ -481,8 +481,8 @@ static VALUE
|
|||
trap(arg)
|
||||
struct trap_arg *arg;
|
||||
{
|
||||
sighandler_t func;
|
||||
VALUE command, old;
|
||||
sighandler_t func, oldfunc;
|
||||
VALUE command, oldcmd;
|
||||
int sig = -1;
|
||||
char *s;
|
||||
|
||||
|
@ -588,9 +588,13 @@ trap(arg)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
ruby_signal(sig, func);
|
||||
old = trap_list[sig];
|
||||
if (!old) old = Qnil;
|
||||
oldfunc = ruby_signal(sig, func);
|
||||
oldcmd = trap_list[sig];
|
||||
if (!oldcmd) {
|
||||
if (oldfunc == SIG_IGN) oldcmd = rb_str_new2("IGNORE");
|
||||
else if (oldfunc == sighandler) oldcmd = rb_str_new2("DEFAULT");
|
||||
else oldcmd = Qnil;
|
||||
}
|
||||
|
||||
trap_list[sig] = command;
|
||||
/* enable at least specified signal. */
|
||||
|
@ -601,7 +605,7 @@ trap(arg)
|
|||
arg->mask &= ~sigmask(sig);
|
||||
#endif
|
||||
#endif
|
||||
return old;
|
||||
return oldcmd;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
|
|
Loading…
Reference in a new issue