Skip to content

Conversation

@jonjohnsonjr
Copy link
Collaborator

Fixes #912

Also, use signal.NotifyContext for cancelling the ctx.

Also, don't log errors twice now that we're using RunE.

@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2021

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.15%. Comparing base (8395cdf) to head (369dd64).
⚠️ Report is 409 commits behind head on main.

Files with missing lines Patch % Lines
pkg/gcrane/options.go 0.00% 4 Missing ⚠️
pkg/crane/options.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #995      +/-   ##
==========================================
- Coverage   75.24%   75.15%   -0.09%     
==========================================
  Files         107      107              
  Lines        5058     5064       +6     
==========================================
  Hits         3806     3806              
- Misses        706      712       +6     
  Partials      546      546              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

}

return remote.Catalog(context.TODO(), reg, o.remote...)
return remote.Catalog(context.Background(), reg, o.remote...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not plumbing context through here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The remote.WithContext in o.remote... will override it.


if err := root.Execute(); err != nil {
fmt.Println(err)
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
Copy link
Contributor

Choose a reason for hiding this comment

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

defer cancel () instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Doesn't os.Exit(1) pre-empt it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ended up doing both instead

@jonjohnsonjr jonjohnsonjr force-pushed the contexts branch 2 times, most recently from 053a029 to 3750ef0 Compare May 14, 2021 16:15
Also, use signal.NotifyContext for cancelling the ctx.
@jonjohnsonjr jonjohnsonjr merged commit 426caf7 into google:main May 18, 2021
@jonjohnsonjr jonjohnsonjr deleted the contexts branch May 18, 2021 20:37
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.

Plumb a signal.NotifyContext through crane/gcrane

3 participants