Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 9bf1357

Browse files
committed
feat: error logs contains command output
1 parent 831e4c2 commit 9bf1357

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/cmd/cmd.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
package cmd
22

33
import (
4+
"errors"
5+
"fmt"
46
"os/exec"
57
)
68

79
// Exec is just wrapper for exec.Command to easier mocking
810
func Exec(name string, args ...string) (string, error) {
9-
out, err := exec.Command(name, args...).Output()
11+
c := exec.Command(name, args...)
12+
13+
out, err := c.CombinedOutput()
1014
if err != nil {
11-
return "", err
15+
errMessage := fmt.Sprintf("%s: %s", err.Error(), out)
16+
return "", errors.New(errMessage)
1217
}
18+
1319
return string(out), nil
1420
}

0 commit comments

Comments
 (0)