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

Command results reader close error is ignored #2282

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ const (
)

var atcTestCases = []struct {
name string
args []string
shouldExpire bool
name string
args []string
shouldExpire bool
// The expected expiry or -1 if we use the default expiry value
expectedExpiry int
expectedScope string
Expand Down
7 changes: 2 additions & 5 deletions utils/cliutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,9 @@ func isEnvFailNoOp() bool {
return strings.ToLower(os.Getenv(coreutils.FailNoOp)) == "true"
}

func CleanupResult(result *commandUtils.Result, originError *error) {
func CleanupResult(result *commandUtils.Result, err *error) {
if result != nil && result.Reader() != nil {
e := result.Reader().Close()
if originError == nil {
*originError = e
}
*err = errors.Join(*err, result.Reader().Close())
}
}

Expand Down
Loading