From ed02c4122a67f209c7c9c4ebdd09647d0ae88e6d Mon Sep 17 00:00:00 2001 From: kosaki Date: Sat, 28 May 2011 13:52:03 +0000 Subject: * process.c (before_exec, after_exec): change SIGPIPE handler to SIG_DFL before calling execve(). Because r31760 reintroduced an issue that system() may hang up (i.e. [ruby-dev:12261]). * process.c (save_sigpipe, restore_sigpipe): new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index de1dcd0bd6..4df883fb53 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1,6 +1,7 @@ require 'test/unit' require 'tmpdir' require 'pathname' +require 'timeout' require_relative 'envutil' require 'rbconfig' @@ -1250,4 +1251,21 @@ class TestProcess < Test::Unit::TestCase exs << Errno::E2BIG if defined?(Errno::E2BIG) assert_raise(*exs, bug4315) {Process.spawn('"a"|'*10_000_000)} end + + def test_system_sigpipe + return if /mswin|mingw/ =~ RUBY_PLATFORM + + pid = 0 + + with_tmpchdir do + assert_nothing_raised('[ruby-dev:12261]') do + timeout(3) do + pid = spawn('yes | ls') + Process.waitpid pid + end + end + end + ensure + Process.kill(:KILL, pid) if (pid != 0) rescue false + end end -- cgit v1.2.3