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

for loop in bash commands can return false positive results #7660

Closed
glazychev-art opened this issue Oct 17, 2022 · 1 comment
Closed

for loop in bash commands can return false positive results #7660

glazychev-art opened this issue Oct 17, 2022 · 1 comment
Assignees

Comments

@glazychev-art
Copy link
Contributor

Description

gotestmd uses the exit code of the last run command.

We use for loop for some tests. But the status of the loop is the status of the last command that executes inside this loop.
For example:

for {
operation1
...
operationN
}

If operation1 returns false, but operationN returns true then $? also returns true. And gotestmd bash won't see the error.

Possible solution

We can use a subshell for for cycles

@glazychev-art glazychev-art self-assigned this Oct 17, 2022
@glazychev-art
Copy link
Contributor Author

Fixed - #7661

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

No branches or pull requests

1 participant