many: replace exec.CombinedOutput when output is parsed - #13223
Merged
Conversation
alfonsosanchezbeato
force-pushed
the
not-parse-stderr
branch
from
September 26, 2023 12:09
ac2b7e6 to
cf8a8bd
Compare
miguelpires
approved these changes
Sep 27, 2023
miguelpires
left a comment
Contributor
There was a problem hiding this comment.
Thank you, this seems very useful
Comment on lines
195
to
196
Contributor
There was a problem hiding this comment.
Suggested change
| // RunSplitOutput runs name command with arg arguments and returs | |
| // stdout, stderr, and an error. | |
| // RunSplitOutput runs name command with arg arguments and returns | |
| // stdout, stderr and an error. |
Contributor
Author
There was a problem hiding this comment.
Thanks, I've changed this
Meulengracht
approved these changes
Sep 27, 2023
Meulengracht
left a comment
Member
There was a problem hiding this comment.
Thank you for fixing this
These functions return separately std{err,out}, and will be used to
replace calls to exec.CombinedOuput.
Some invocations to external programs used exec.CombinedOutput, that combines stdout and strerr into a single byte array. This can be an issue if this output is parsed, as many programs print debug output or warnings to stderr and that data is unexpected by the parsers. This patch changes to using osutil.RunSplitOutput or osutil.RunCmd (that return separately stdout and stderr) when we need to parse stdout, and also in some other cases when printing separately both streams could be helpful. Fixes LP #1885597.
alfonsosanchezbeato
force-pushed
the
not-parse-stderr
branch
from
October 5, 2023 11:47
cf8a8bd to
bc96085
Compare
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.
Some invocations to external programs used exec.CombinedOutput, that
combines stdout and strerr into a single byte array. This can be an
issue if this output is parsed, as many programs print debug output or
warnings to stderr and that data is unexpected by the parsers. This
patch changes to using osutil.RunSplitOutput or osutil.RunCmd (that
return separately stdout and stderr) when we need to parse stdout, and
also in some other cases when printing separately both streams could
be helpful. Fixes LP #1885597.