Skip to content

Commit

Permalink
Merge pull request #97 from tamird/protoc-gen-combo-errors
Browse files Browse the repository at this point in the history
Make `protoc-gen-combo` actually report errors
  • Loading branch information
awalterschulze committed Aug 28, 2015
2 parents 70fa9c3 + ab19286 commit 6cab0cc
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions protoc-gen-gogo/protoc-gen-combo/combo.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
package main

import (
"bufio"
"bytes"
"flag"
"fmt"
"github.com/gogo/protobuf/protoc-gen-gogo/version"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/gogo/protobuf/protoc-gen-gogo/version"
)

type MixMatch struct {
Expand Down Expand Up @@ -69,9 +72,24 @@ func (this MixMatch) Gen(folder string, news []string) {
args = append(args, filepath.Join(folder, this.Filename))
var regenerate = exec.Command("protoc", args...)
out, err := regenerate.CombinedOutput()

failed := false
scanner := bufio.NewScanner(bytes.NewReader(out))
for scanner.Scan() {
text := scanner.Text()
fmt.Println("protoc-gen-combo: ", text)
if !strings.Contains(text, "WARNING") {
failed = true
}
}

if err != nil {
fmt.Printf("%s\n", string(out))
panic(err)
fmt.Print("protoc-gen-combo: error: ", err)
failed = true
}

if failed {
os.Exit(1)
}
}

Expand Down

0 comments on commit 6cab0cc

Please sign in to comment.