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

Fix --timeout flag #569

Merged
merged 2 commits into from
Jul 22, 2020
Merged

Fix --timeout flag #569

merged 2 commits into from
Jul 22, 2020

Conversation

rahul2393
Copy link
Contributor

Comment on lines 68 to 73
ctx := context.Background()
if c.Timeout > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, c.Timeout)
defer cancel()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Timeout has the default value.

Value: time.Second * 120,

How about the following way?

Suggested change
ctx := context.Background()
if c.Timeout > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, c.Timeout)
defer cancel()
}
ctx := context.WithTimeout(context.Background(), c.Timeout)
defer cancel()

Comment on lines 49 to 53
if c.Timeout > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, c.Timeout)
defer cancel()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@knqyf263 done

@knqyf263 knqyf263 merged commit d6b37cb into aquasecurity:master Jul 22, 2020
liamg pushed a commit that referenced this pull request Jun 7, 2022
* Wrapped scan call inside context timeout

* timeout has default value
josedonizetti pushed a commit to josedonizetti/trivy that referenced this pull request Jun 24, 2022
* feat: Add hcl syntax highlighting
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.

None yet

2 participants