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

fix protoc output parsing bug #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arnaudbriche
Copy link

The parseFile function execute a protoc process to retrieve the message descriptor from a file and then parse from the output of the process, but it makes use of the CombinedOutput method of the Cmd struct, which combined both the stdout and stderr of the process, leading to imparseable string when the protoc process emits warnings on stderr.
I just replaced the call to CombinedOutput but a call to Output, which only returns stdout.

@@ -60,7 +60,7 @@ func parseFile(filename string, includeSourceInfo bool, includeImports bool, pat
args = append(args, filename)
cmd := exec.Command("protoc", args...)
cmd.Env = []string{}
data, err := cmd.CombinedOutput()
data, err := cmd.Output()
if err != nil {
return nil, &errCmd{data, err}
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately the fix is a little more complicated than that.
The data returned in the error command now doesn't include the stderr.

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.

None yet

2 participants