* 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
This commit is contained in:
kosaki 2011-05-28 13:52:03 +00:00
parent e39b50d4b5
commit ed02c4122a
3 changed files with 54 additions and 7 deletions

View file

@ -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