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 RunWithContext + remove signal cancellation #975

Merged
merged 2 commits into from Dec 6, 2019

Conversation

marwan-at-work
Copy link
Contributor

Fixes #945

@marwan-at-work marwan-at-work requested a review from a team as a code owner December 4, 2019 20:37
@codecov
Copy link

codecov bot commented Dec 4, 2019

Codecov Report

Merging #975 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #975      +/-   ##
==========================================
+ Coverage   73.36%   73.38%   +0.02%     
==========================================
  Files          32       32              
  Lines        2440     2435       -5     
==========================================
- Hits         1790     1787       -3     
+ Misses        540      539       -1     
+ Partials      110      109       -1
Impacted Files Coverage Δ
app.go 77.16% <100%> (+0.18%) ⬆️
context.go 95.38% <100%> (+1.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72c7fac...7daa2d1. Read the comment docs.

@@ -224,7 +232,7 @@ func (a *App) Run(arguments []string) (err error) {

err = parseIter(set, a, arguments[1:], shellComplete)
nerr := normalizeFlags(a.Flags, set)
context := NewContext(a, set, nil)
context := NewContext(a, set, &Context{Context: ctx})
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this still work of user does RunWithContext(nil, args)

Copy link
Member

Choose a reason for hiding this comment

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

Passing a nil Context is always a developer error.

From the docs:

Do not pass a nil Context, even if a function permits it. Pass context.TODO if you are unsure about which Context to use.

We shouldn't need to support that

app.go Outdated Show resolved Hide resolved
Copy link
Member

@rliebz rliebz left a comment

Choose a reason for hiding this comment

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

LGTM, pending RunWithContext -> RunContext

@marwan-at-work
Copy link
Contributor Author

@rliebz @AudriusButkevicius PR updated :)

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

@AudriusButkevicius AudriusButkevicius merged commit 0fae425 into urfave:master Dec 6, 2019
@coilysiren coilysiren mentioned this pull request Dec 24, 2019
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.

v2 feature: Allow registering ctrl-c with the app
4 participants