fix(client): show git's own error instead of exit status
This commit is contained in:
1 parent
95fc50e2c2
commit
ae76eab797
1 file changed
+4
@@ -22,6 +22,10 @@ type Repo struct {
|
||||
|
||||
func run(dir string, args ...string) (string, error) {
|
||||
out, err := exec.Command("git", append([]string{"-C", dir}, args...)...).Output()
|
||||
var failed *exec.ExitError
|
||||
if errors.As(err, &failed) && len(failed.Stderr) > 0 {
|
||||
err = errors.New(strings.TrimPrefix(strings.TrimSpace(string(failed.Stderr)), "fatal: "))
|
||||
}
|
||||
return strings.TrimRight(string(out), "\n"), err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user