libcontainerd/windows: Fix cleanup on newIOFromProcess error#46476
Merged
thaJeztah merged 3 commits intomoby:masterfrom Sep 18, 2023
Merged
libcontainerd/windows: Fix cleanup on newIOFromProcess error#46476thaJeztah merged 3 commits intomoby:masterfrom
newIOFromProcess error#46476thaJeztah merged 3 commits intomoby:masterfrom
Conversation
… failure Error check in defer block used wrong error variable which is always nil if the flow reaches the defer. This caused the `newProcess.Kill` to be never called if the subsequent attemp to attach to the stdio failed. Although this only happens in Exec (as Start does overwrite the error), this also adjusts the Start to also use the returned error to avoid this kind of mistake in future changes. Signed-off-by: Paweł Gronowski <[email protected]>
The cleanup defer uses an `outErr` now, so we don't need to worry about shadowing. Signed-off-by: Paweł Gronowski <[email protected]>
Synchronize the code to do the same thing as Exec. reap doesn't need to be called before the start event was sent. There's already a defer block which cleans up the process in case where an error occurs. Signed-off-by: Paweł Gronowski <[email protected]>
thaJeztah
approved these changes
Sep 15, 2023
Member
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM, nice!
should we backport this one?
Contributor
Author
|
Opened a backport for 24.0. |
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.
- What I did
Fixed new process not being killed and deleted when
newIOFromProcesswould fail.- How I did it
See commits.
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)