ruby-changes:46137
From: nobu <ko1@a...>
Date: Wed, 5 Apr 2017 10:36:25 +0900 (JST)
Subject: [ruby-changes:46137] nobu:r58251 (trunk): default.mspec: job server
nobu 2017-04-05 10:36:21 +0900 (Wed, 05 Apr 2017) New Revision: 58251 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58251 Log: default.mspec: job server * spec/default.mspec: override MSpecScript#cores by the tokens from the parent make job server. Modified files: trunk/spec/default.mspec Index: spec/default.mspec =================================================================== --- spec/default.mspec (revision 58250) +++ spec/default.mspec (revision 58251) @@ -24,3 +24,28 @@ class MSpecScript https://github.com/ruby/ruby/blob/trunk/spec/default.mspec#L24 -- ] end + +class MSpecScript + if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ ENV["MAKEFLAGS"] + begin + r = IO.for_fd($1.to_i(10), "rb", autoclose: false) + w = IO.for_fd($2.to_i(10), "wb", autoclose: false) + rescue + r.close if r + else + jobtokens = r.read_nonblock(1024) + cores = jobtokens.size + if cores > 0 + jobserver = w + at_exit { + jobserver.print(jobtokens) + jobserver.close + } + end + remove_method :cores + define_method(:cores) do + cores + end + end + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/