Created
December 3, 2019 16:58
-
-
Save zdennis/016fb9f446eeb7ff8fa599eb2d9cc4aa to your computer and use it in GitHub Desktop.
Treat all arguments a command to be run.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
MAX_RETRIES = 4 | |
SLEEP=2 | |
COMMAND=ARGV.join(' ') | |
count = 0 | |
loop do | |
puts "Running: #{COMMAND.inspect}" | |
unless system(COMMAND) | |
abort "The command failed" | |
end | |
count += 1 | |
if count == MAX_RETRIES | |
abort "The command passed #{count} times." | |
end | |
sleep 2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment