diff options
-rw-r--r-- | test/ruby/test_io.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index a5503cad8f..eac4e59a8f 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1080,7 +1080,9 @@ class TestIO < Test::Unit::TestCase def ruby(*args) args = ['-e', '$>.write($<.read)'] if args.empty? ruby = EnvUtil.rubybin - f = IO.popen([ruby] + args, 'r+') + opts = {} + opts[:rlimit_nproc] = 1024 if /mswin|mingw/ =~ RUBY_PLATFORM + f = IO.popen([ruby] + args, 'r+', opts) pid = f.pid yield(f) ensure diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 7345cc3b3c..2910ff8bd4 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1596,11 +1596,13 @@ class TestProcess < Test::Unit::TestCase cmds = Array.new(min, cmd) exs = [Errno::ENOENT] exs << Errno::E2BIG if defined?(Errno::E2BIG) + opts = {[STDOUT, STDERR]=>File::NULL} + opts[:rlimit_nproc] = 128 if /mswin|mingw/ =~ RUBY_PLATFORM EnvUtil.suppress_warning do assert_raise(*exs, mesg) do begin loop do - Process.spawn(cmds.join(sep), [STDOUT, STDERR]=>File::NULL, rlimit_nproc: 1) + Process.spawn(cmds.join(sep), opts) min = [cmds.size, min].max cmds *= 100 end |