Merged
Conversation
Pass a context down to *exec.Command and make timing out optional when o.Timeout < 0. Using `context.Background()` _all the time_ is not practical as sometimes we need to stop the execution when _a_ parent context stops. Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Contributor
Author
|
@unknwon let me know what you think |
Member
Thanks, I think it should be great, but I would need to double check https://github.com/gogs/gogs because some places might have just assumed |
Contributor
Author
|
I've made some additional changes and deprecated the old options timeout in favor of using |
CommandOptions now can take a context and a timeout. Deprecate current options timeout property in favor of that. The current behavior is not affected and RunWithTimeout methods should be removed in the future. Use *Command.WithTimeout and *Command.SetTimeout instead. Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 83.68% 83.41% -0.28%
==========================================
Files 28 28
Lines 1784 1809 +25
==========================================
+ Hits 1493 1509 +16
- Misses 176 182 +6
- Partials 115 118 +3 |
Member
|
https://github.com/gogs/git-module/releases/tag/v1.8.2 has been created for this merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pass a context down to *exec.Command and make timing out optional when o.Timeout < 0.
Using
context.Background()all the time is not practical as sometimes we need to stop the execution when a parent context stops.Describe the pull request
A clear and concise description of what the pull request is about, i.e. what problem should be fixed?
Link to the issue:
Checklist