ruby 2.7 compatibility - #117
This commit is contained in:
parent
fbe60f6ba2
commit
dded5e2648
@ -1,7 +1,6 @@
|
|||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "set"
|
require "set"
|
||||||
require "shellwords"
|
require "shellwords"
|
||||||
require "thwait"
|
|
||||||
|
|
||||||
module Rscons
|
module Rscons
|
||||||
# The Environment class is the main programmatic interface to Rscons. It
|
# The Environment class is the main programmatic interface to Rscons. It
|
||||||
@ -702,10 +701,7 @@ module Rscons
|
|||||||
!thread.alive?
|
!thread.alive?
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if @threads.empty?
|
Util.wait_for_thread(*@threads.keys)
|
||||||
raise "No threads to wait for"
|
|
||||||
end
|
|
||||||
ThreadsWait.new(*@threads.keys).next_wait
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -191,6 +191,32 @@ module Rscons
|
|||||||
deps
|
deps
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
# Check if a directory contains a certain executable.
|
# Check if a directory contains a certain executable.
|
||||||
|
@ -143,7 +143,7 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
stdout, stderr, status = nil, nil, nil
|
stdout, stderr, status = nil, nil, nil
|
||||||
Bundler.with_clean_env do
|
Bundler.with_unbundled_env do
|
||||||
env = ENV.to_h
|
env = ENV.to_h
|
||||||
path = ["#{@build_test_run_dir}/_bin", "#{env["PATH"]}"]
|
path = ["#{@build_test_run_dir}/_bin", "#{env["PATH"]}"]
|
||||||
if options[:path]
|
if options[:path]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user