Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for return code of retried command #2

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

mimi1vx
Copy link
Contributor

@mimi1vx mimi1vx commented Nov 22, 2023

This fixes poo#138491

When command failed with retries eq "0" retry script always return 0 as success which can be false positive

So this change adds check for return code if $retries -eq 0

Copy link
Owner

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one minor typo in the string, rest looks great!

This fixes poo#138491

When command failed with retries eq "0" retry script always
return 0 as success which can be false positive

So this change adds check for return code if $retries -eq 0
@mergify mergify bot merged commit fbcdfe5 into okurz:main Nov 22, 2023
@perlpunk
Copy link
Contributor

perlpunk commented Nov 22, 2023

This still returns 1 if there were more than zero retries:

% ./retry -r 3 -s 1 -- perl -wE'print "input: ";chomp(my $rc=<STDIN>); exit $rc'
input: 1
Retrying up to 3 more times after sleeping 1s …
input: 1
Retrying up to 2 more times after sleeping 1s …
input: 1
Retrying up to 1 more times after sleeping 1s …
input: 0
% echo $?
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants