Skip to content

Commit 30cc9b9

Browse files
committed
Ensure the passed jobserver FDs are valid
If invalid, clear `-j` option from `$MAKEFLAGS`.
1 parent fc35608 commit 30cc9b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/ruby/optional/capi/spec_helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,12 @@ def setup_make
127127
opts = {}
128128
if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ make_flags
129129
[$1, $2].each do |fd|
130-
fd = fd.to_i(10)
130+
fd = IO.for_fd(fd.to_i(10), autoclose: false)
131131
opts[fd] = fd
132+
rescue
133+
make_flags.sub!(/\A-\S*\Kj\d+/, '')
134+
opts.clear
135+
break
132136
end
133137
end
134138

0 commit comments

Comments
 (0)