signal.c: directly deliver non-handlable signals

* signal.c (rb_f_kill): directly deliver signals which cannot be
  handled, i.e., SIGKILL and SIGSTOP.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-11 01:02:47 +00:00
Родитель c6e9e4110e
Коммит a3656d4222
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -464,6 +464,12 @@ rb_f_kill(int argc, VALUE *argv)
case SIGSEGV:
#ifdef SIGBUS
case SIGBUS:
#endif
#ifdef SIGKILL
case SIGKILL:
#endif
#ifdef SIGSTOP
case SIGSTOP:
#endif
ruby_kill(pid, sig);
break;

Просмотреть файл

@ -1200,6 +1200,21 @@ class TestProcess < Test::Unit::TestCase
end
def test_status_kill
return unless Process.respond_to?(:kill)
return unless Signal.list.include?("KILL")
with_tmpchdir do
write_file("foo", "Process.kill(:KILL, $$); exit(42)")
system(RUBY, "foo")
s = $?
assert_equal([false, true, false, nil],
[s.exited?, s.signaled?, s.stopped?, s.success?],
"[s.exited?, s.signaled?, s.stopped?, s.success?]")
assert_equal(false, s.exited?)
end
end
def test_status_quit
return unless Process.respond_to?(:kill)
return unless Signal.list.include?("QUIT")