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.
Implements #6.
This is a continuation of #18, where we made
Job
context aware. At the time of opening this PR we have the following situation:NestedTask
only passes down the context to its children. It doesn't check in its state if the context is done or not; perhaps we could make it that it only calls its childrenPoll
method only if the context is not done.ShellTask
is ignoring the context completely. We could change it to either create the command usingnow stops the process if the context is cancelled.exec.CommandContext
and ignore the context on each polling iteration, or checking if the context is done when polling and callProcess.Kill
on the running processCallbackTask
is passing a custom context with a 1s timeout when calling the callback function. I believe it would be better if we just pass the context directly or if we add the timeout but using the given context as its parent instead of a newnow it passes down thecontext.Background
Poll
context argument. In addition, the timeout could be configurable instead of hardcoded. I'm still not sure if the callback should be called if the context was done 🤔Opening as a draft while we discussed the points mentioned above.