Updated runner to throw better errors

This commit is contained in:
Spencer
2018-07-20 14:06:46 -04:00
parent f239907bb2
commit 70211f66b0

View File

@@ -8,7 +8,6 @@ package runner
import ( import (
"bytes" "bytes"
"errors"
"fmt" "fmt"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@@ -52,7 +51,7 @@ func Run(name string, args ...string) ([]byte, error) {
cmd := exec.Command(std.Cmd, parseArgs(name, args...)...) cmd := exec.Command(std.Cmd, parseArgs(name, args...)...)
cmd.Stdout, cmd.Stderr = &out, &errs cmd.Stdout, cmd.Stderr = &out, &errs
if err := cmd.Run(); err != nil || len(errs.Bytes()) != 0 { if err := cmd.Run(); err != nil || len(errs.Bytes()) != 0 {
return out.Bytes(), errors.New(errs.String()) return out.Bytes(), fmt.Errorf("err: \"%s\"\nargs: \"%s\"\nout: \"%s\"", errs.String(), args, out.String())
} }
return out.Bytes(), nil return out.Bytes(), nil
} }