rscons/build_tests/simple/wait_for_builds_on_failure.rb
Josh Holtrop b882f8de99 Rework builder interface to only use #run method - close #91
The builder's #run method will be called repeatedly until it returns
true or false. The Builder#wait_for method can be used to cause a
builder to wait for a Thread, Command, or another Builder.
2019-02-17 22:08:39 -05:00

23 lines
516 B
Ruby

class Fail < Rscons::Builder
def run(options)
if @command
finalize_command
else
wait_time = @env.expand_varref("${wait_time}", @vars)
ruby_command = %[sleep #{wait_time}; exit 2]
@command = %W[ruby -e #{ruby_command}]
register_command("Fail #{@target}", @command)
end
end
end
build do
Environment.new do |env|
env.add_builder(Fail)
4.times do |i|
wait_time = i + 1
env.Fail("foo_#{wait_time}", [], "wait_time" => wait_time.to_s)
end
end
end