diff --git a/plugins/inputs/zfs/zfs_freebsd.go b/plugins/inputs/zfs/zfs_freebsd.go index 24f6a50997612..e493e3fc9a0bb 100644 --- a/plugins/inputs/zfs/zfs_freebsd.go +++ b/plugins/inputs/zfs/zfs_freebsd.go @@ -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 }