ruby 2.7 compatibility - #117
This commit is contained in:
parent
fbe60f6ba2
commit
dded5e2648
@ -1,7 +1,6 @@
|
||||
require "fileutils"
|
||||
require "set"
|
||||
require "shellwords"
|
||||
require "thwait"
|
||||
|
||||
module Rscons
|
||||
# The Environment class is the main programmatic interface to Rscons. It
|
||||
@ -702,10 +701,7 @@ module Rscons
|
||||
!thread.alive?
|
||||
end
|
||||
else
|
||||
if @threads.empty?
|
||||
raise "No threads to wait for"
|
||||
end
|
||||
ThreadsWait.new(*@threads.keys).next_wait
|
||||
Util.wait_for_thread(*@threads.keys)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,6 +191,32 @@ module Rscons
|
||||
deps
|
||||
end
|
||||
|
||||
# Wait for any of a number of threads to complete.
|
||||
#
|
||||
# @param threads [Array<Thread>]
|
||||
# Threads to wait for.
|
||||
#
|
||||
# @return [Thread]
|
||||
# The Thread that completed.
|
||||
def wait_for_thread(*threads)
|
||||
if threads.empty?
|
||||
raise "No threads to wait for"
|
||||
end
|
||||
queue = Queue.new
|
||||
threads.each do |thread|
|
||||
# Create a wait thread for each thread we're waiting for.
|
||||
Thread.new do
|
||||
begin
|
||||
thread.join
|
||||
ensure
|
||||
queue.push(thread)
|
||||
end
|
||||
end
|
||||
end
|
||||
# Wait for any thread to complete.
|
||||
queue.pop
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Check if a directory contains a certain executable.
|
||||
|
@ -143,7 +143,7 @@ EOF
|
||||
end
|
||||
end
|
||||
stdout, stderr, status = nil, nil, nil
|
||||
Bundler.with_clean_env do
|
||||
Bundler.with_unbundled_env do
|
||||
env = ENV.to_h
|
||||
path = ["#{@build_test_run_dir}/_bin", "#{env["PATH"]}"]
|
||||
if options[:path]
|
||||
|
Loading…
x
Reference in New Issue
Block a user