fix: Check return code of zfs command for FreeBSD. (#9956)
This commit is contained in:
parent
8f35d74c5e
commit
aa2f1b150e
|
|
@ -174,9 +174,12 @@ func run(command string, args ...string) ([]string, error) {
|
||||||
stdout := strings.TrimSpace(outbuf.String())
|
stdout := strings.TrimSpace(outbuf.String())
|
||||||
stderr := strings.TrimSpace(errbuf.String())
|
stderr := strings.TrimSpace(errbuf.String())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
if _, ok := err.(*exec.ExitError); ok {
|
if _, ok := err.(*exec.ExitError); ok {
|
||||||
return nil, fmt.Errorf("%s error: %s", command, stderr)
|
return nil, fmt.Errorf("%s error: %s", command, stderr)
|
||||||
}
|
}
|
||||||
|
return nil, fmt.Errorf("%s error: %s", command, err)
|
||||||
|
}
|
||||||
return strings.Split(stdout, "\n"), nil
|
return strings.Split(stdout, "\n"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue