summaryrefslogtreecommitdiff
path: root/test/ruby/test_signal.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-20 00:50:58 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-20 00:50:58 +0000
commit29996bb313088f448cc323e16f4e2a91d2008914 (patch)
tree3e6b96435a7937a8fdb11be265763554d36c74e1 /test/ruby/test_signal.rb
parent029b59ba53d0cc42630d623b52d94cae0df62734 (diff)
Don't send INT signal itself.
On make test-all, it kills the process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_signal.rb')
-rw-r--r--test/ruby/test_signal.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb
index eaf21b8f2d..f58eea5ddb 100644
--- a/test/ruby/test_signal.rb
+++ b/test/ruby/test_signal.rb
@@ -243,19 +243,21 @@ EOS
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