kadwanev / retry

The command line retry tool
254 stars 28 forks source link

Fail script will run even if last attempt is successful #9

Closed barrycohen closed 6 years ago

barrycohen commented 6 years ago

If a command fails a few times but then succeeds on the final attempt, retry will still print

Retries exhausted

or

Retries exhaused, running fail script

and then return 0.

I think the line

if [ $attempts -gt $max_tries ]; then

needs to be

if [[ $return_code -ne 0 && $attempts -gt $max_tries ]]; then

to fix this.

kadwanev commented 6 years ago

Thank you for this report! I decided to fix it a little differently as originally intended.

barrycohen commented 6 years ago

Excellent, thanks for the quick fix. Awesome tool, by the way!

kadwanev commented 6 years ago

@barrycohen Thanks! If you wouldn't mind adding a star? Apparentlly, the OSX brew package manager wants to see 50 stars before adding any formula.

barrycohen commented 6 years ago

No problem, added. Good luck!