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