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

ruby-changes:25679

From: naruse <ko1@a...>
Date: Tue, 20 Nov 2012 09:59:44 +0900 (JST)
Subject: [ruby-changes:25679] naruse:r37736 (trunk): Don't send INT signal itself.

naruse	2012-11-20 09:50:58 +0900 (Tue, 20 Nov 2012)

  New Revision: 37736

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

  Log:
    Don't send INT signal itself.
    
    On make test-all, it kills the process.

  Modified files:
    trunk/test/ruby/test_signal.rb

Index: test/ruby/test_signal.rb
===================================================================
--- test/ruby/test_signal.rb	(revision 37735)
+++ test/ruby/test_signal.rb	(revision 37736)
@@ -243,19 +243,21 @@
   def test_signame
     return unless Process.respond_to?(:kill)
 
-    begin
-      10.times do
-        caught = 0
-        signame = "wrong"
-
-        Signal.trap("INT") { |signo| signame = Signal.signame(signo); caught = 1;  }
-        Process.kill("INT", 0)
-
-        sleep 0.01 while caught==0
+    10.times do
+      IO.popen([EnvUtil.rubybin, "-e", <<EOS, :err => File::NULL]) do |child|
+        Signal.trap("INT") do |signo|
+          signame = Signal.signame(signo)
+          Marshal.dump(signame, STDOUT)
+          STDOUT.flush
+          exit 0
+        end
+        sleep
+EOS
+        sleep 0.1
+        Process.kill("INT", child.pid)
+        signame = Marshal.load(child)
         assert_equal(signame, "INT")
       end
-    ensure
-      Signal.trap("INT", "DEFAULT")
     end
   end
 end

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

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