rscons/build_tests/simple/wait_for_builds_on_failure.rb
Josh Holtrop ef7e9259cb Add shortcut method for creating environments - close #149
Add env() method to create environments.
Process all environments created at build script top level before
executing any autoconf-enabled tasks, or if no tasks are specified by
the user.
2022-02-12 21:59:52 -05:00

21 lines
477 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
env 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