[前][次][番号順一覧][スレッド一覧]

ruby-changes:40192

From: naruse <ko1@a...>
Date: Sun, 25 Oct 2015 03:21:47 +0900 (JST)
Subject: [ruby-changes:40192] naruse:r52273 (trunk): use rlimit_nproc other than Windows

naruse	2015-10-25 03:21:39 +0900 (Sun, 25 Oct 2015)

  New Revision: 52273

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52273

  Log:
    use rlimit_nproc other than Windows

  Modified files:
    trunk/test/ruby/test_io.rb
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 52272)
+++ test/ruby/test_io.rb	(revision 52273)
@@ -1080,7 +1080,9 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L1080
   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
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 52272)
+++ test/ruby/test_process.rb	(revision 52273)
@@ -1596,11 +1596,13 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1596
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]