[前][次][番号順一覧][スレッド一覧]

ruby-changes:33836

From: nobu <ko1@a...>
Date: Sun, 11 May 2014 10:02:53 +0900 (JST)
Subject: [ruby-changes:33836] nobu:r45917 (trunk): signal.c: directly deliver non-handlable signals

nobu	2014-05-11 10:02:47 +0900 (Sun, 11 May 2014)

  New Revision: 45917

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45917

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

  Modified files:
    trunk/signal.c
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 45916)
+++ test/ruby/test_process.rb	(revision 45917)
@@ -1201,6 +1201,21 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1201
 
   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")
 
     with_tmpchdir do
Index: signal.c
===================================================================
--- signal.c	(revision 45916)
+++ signal.c	(revision 45917)
@@ -465,6 +465,12 @@ rb_f_kill(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/signal.c#L465
 #ifdef SIGBUS
 		  case SIGBUS:
 #endif
+#ifdef SIGKILL
+		  case SIGKILL:
+#endif
+#ifdef SIGSTOP
+		  case SIGSTOP:
+#endif
 		    ruby_kill(pid, sig);
 		    break;
 		  default:

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]