Merge pull request #102 from hulucc/master

fix: better command err info
This commit is contained in:
net-byte 2023-09-25 13:33:21 +08:00 committed by GitHub
commit cedf869df9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,11 @@ func ExecCmd(c string, args ...string) string {
cmd := exec.Command(c, args...)
out, err := cmd.Output()
if err != nil {
log.Println("failed to exec cmd:", err)
if exitErr, ok := err.(*exec.ExitError); ok {
log.Println("failed to exec cmd:", err, string(exitErr.Stderr))
} else {
log.Println("failed to exec cmd:", err)
}
}
if len(out) == 0 {
return ""