1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert jobserver handling in spec

This commit is contained in:
Nobuyoshi Nakada 2022-11-07 15:51:04 +09:00
parent b02b8e7756
commit ee86b57ee5
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 6 additions and 22 deletions

View file

@ -29,19 +29,11 @@ end
module MSpecScript::JobServer module MSpecScript::JobServer
def cores(max = 1) def cores(max = 1)
if max > 1 and /(?:\A|\s)--jobserver-(?:auth|fds)=(?:(\d+),(\d+)|fifo:((?:\\.|\S)+))/ =~ ENV["MAKEFLAGS"] if max > 1 and /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ ENV["MAKEFLAGS"]
cores = 1 cores = 1
begin begin
if fifo = $3 r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
fifo.gsub!(/\\(?=.)/, '') w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
r = File.open(fifo, IO::RDONLY|IO::NONBLOCK|IO::BINARY)
w = File.open(fifo, IO::WRONLY|IO::NONBLOCK|IO::BINARY)
else
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
end
r.close_on_exec = true
w.close_on_exec = true
jobtokens = r.read_nonblock(max - 1) jobtokens = r.read_nonblock(max - 1)
cores = jobtokens.size cores = jobtokens.size
if cores > 0 if cores > 0

View file

@ -113,20 +113,12 @@ def setup_make
end end
opts = {} opts = {}
if /(?:\A|\s)--jobserver-(?:auth|fds)=(?:(\d+),(\d+)|fifo:((?:\\.|\S)+))/ =~ make_flags if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ make_flags
begin begin
if fifo = $3 r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
fifo.gsub!(/\\(?=.)/, '') w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
r = File.open(fifo, IO::RDONLY|IO::NONBLOCK|IO::BINARY)
w = File.open(fifo, IO::WRONLY|IO::NONBLOCK|IO::BINARY)
else
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
end
rescue Errno::EBADF rescue Errno::EBADF
else else
r.close_on_exec = true
w.close_on_exec = true
opts[r] = r opts[r] = r
opts[w] = w opts[w] = w
end end