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

ruby-changes:33813

From: akr <ko1@a...>
Date: Sat, 10 May 2014 08:49:01 +0900 (JST)
Subject: [ruby-changes:33813] akr:r45894 (trunk): * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.

akr	2014-05-10 08:48:47 +0900 (Sat, 10 May 2014)

  New Revision: 45894

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

  Log:
    * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.

  Modified files:
    trunk/ChangeLog
    trunk/signal.c
    trunk/test/ruby/test_signal.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45893)
+++ ChangeLog	(revision 45894)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May 10 08:47:36 2014  Tanaka Akira  <akr@f...>
+
+	* signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.
+
 Fri May  9 14:27:05 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (RUBY_SETJMP_TYPE): check for setjmp type after
Index: test/ruby/test_signal.rb
===================================================================
--- test/ruby/test_signal.rb	(revision 45893)
+++ test/ruby/test_signal.rb	(revision 45894)
@@ -175,6 +175,13 @@ class TestSignal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_signal.rb#L175
     end;
   end if Process.respond_to?(:kill)
 
+  def test_trap_system_default
+    assert_separately([], <<-End)
+      trap(:QUIT, "SYSTEM_DEFAULT")
+      assert_equal("SYSTEM_DEFAULT", trap(:QUIT, "DEFAULT"))
+    End
+  end
+
   def test_signal_requiring
     t = Tempfile.new(%w"require_ensure_test .rb")
     t.puts "sleep"
Index: signal.c
===================================================================
--- signal.c	(revision 45893)
+++ signal.c	(revision 45894)
@@ -976,6 +976,7 @@ trap(int sig, sighandler_t func, VALUE c https://github.com/ruby/ruby/blob/trunk/signal.c#L976
     switch (oldcmd) {
       case 0:
 	if (oldfunc == SIG_IGN) oldcmd = rb_str_new2("IGNORE");
+        else if (oldfunc == SIG_DFL) oldcmd = rb_str_new2("SYSTEM_DEFAULT");
 	else if (oldfunc == sighandler) oldcmd = rb_str_new2("DEFAULT");
 	else oldcmd = Qnil;
 	break;

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

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