diff --git a/fizz/bubbler_test.go b/fizz/bubbler_test.go index dfcfa08c..dcd431df 100644 --- a/fizz/bubbler_test.go +++ b/fizz/bubbler_test.go @@ -13,7 +13,6 @@ func Test_Exec(t *testing.T) { b := NewBubbler(nil) f := fizzer{b} bb := &bytes.Buffer{} - err := f.Exec(bb).(func(string) error)("echo hello") - r.NoError(err) + f.Exec(bb).(func(string))("echo hello") r.Equal("hello\n", bb.String()) } diff --git a/fizz/fizz.go b/fizz/fizz.go index b2b69261..c0b679dd 100644 --- a/fizz/fizz.go +++ b/fizz/fizz.go @@ -1,6 +1,7 @@ package fizz import ( + "fmt" "io" "io/ioutil" "log" @@ -24,13 +25,16 @@ func (f fizzer) add(s string, err error) error { } func (f fizzer) Exec(out io.Writer) interface{} { - return func(s string) error { + return func(s string) { args := strings.Split(s, " ") cmd := exec.Command(args[0], args[1:]...) cmd.Stdin = os.Stdin cmd.Stdout = out cmd.Stderr = os.Stderr - return cmd.Run() + err := cmd.Run() + if err != nil { + panic(fmt.Sprintf("error executing command: %s", s)) + } } }