ruby 2.7 compatibility - #117
This commit is contained in:
parent
93c5561190
commit
b6f0e61052
@ -5,6 +5,7 @@ require_relative "rscons/cache"
|
||||
require_relative "rscons/environment"
|
||||
require_relative "rscons/job_set"
|
||||
require_relative "rscons/threaded_command"
|
||||
require_relative "rscons/util"
|
||||
require_relative "rscons/varset"
|
||||
require_relative "rscons/version"
|
||||
|
||||
|
@ -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
|
||||
@ -1012,10 +1011,7 @@ module Rscons
|
||||
!thread.alive?
|
||||
end
|
||||
else
|
||||
if threads.empty?
|
||||
raise "No threads to wait for"
|
||||
end
|
||||
ThreadsWait.new(*threads).next_wait
|
||||
Util.wait_for_thread(*threads)
|
||||
end
|
||||
end
|
||||
|
||||
|
34
lib/rscons/util.rb
Normal file
34
lib/rscons/util.rb
Normal file
@ -0,0 +1,34 @@
|
||||
module Rscons
|
||||
# A collection of stand-alone utility methods.
|
||||
module Util
|
||||
class << self
|
||||
|
||||
# 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
|
||||
|
||||
end
|
||||
end
|
||||
end
|
@ -97,7 +97,7 @@ ENV["TERM"] = nil
|
||||
EOF
|
||||
end
|
||||
stdout, stderr, status = nil, nil, nil
|
||||
Bundler.with_clean_env do
|
||||
Bundler.with_unbundled_env do
|
||||
stdout, stderr, status = Open3.capture3(*command)
|
||||
end
|
||||
# Remove output lines generated as a result of the test environment
|
||||
|
Loading…
x
Reference in New Issue
Block a user