diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-28 13:52:03 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-28 13:52:03 +0000 |
commit | ed02c4122a67f209c7c9c4ebdd09647d0ae88e6d (patch) | |
tree | 07a9576a8d68c622988debe9c891414897e23657 /test/ruby/test_process.rb | |
parent | e39b50d4b5531b84386862b47c3d3d273e6c32c7 (diff) | |
download | ruby-ed02c4122a67f209c7c9c4ebdd09647d0ae88e6d.tar.gz |
* 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
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r-- | test/ruby/test_process.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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 |