mirror of
https://github.com/sbrow/ps.git
synced 2025-12-29 18:47:38 -05:00
Updated runner to throw better errors
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user