From 5509b199fbf839aad0fa25fda630499f49323334 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 16 Jun 2020 07:53:23 +0200 Subject: [PATCH] use new run_command helper --- src/tools/disks/lvm.rs | 6 +----- src/tools/disks/smart.rs | 6 +----- src/tools/disks/zfs.rs | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/tools/disks/lvm.rs b/src/tools/disks/lvm.rs index 1bcce703..4c9afb01 100644 --- a/src/tools/disks/lvm.rs +++ b/src/tools/disks/lvm.rs @@ -25,11 +25,7 @@ pub fn get_lvm_devices( let mut command = std::process::Command::new(PVS_BIN_PATH); command.args(&["--reportformat", "json", "--noheadings", "--readonly", "-o", "pv_name"]); - let output = command.output() - .map_err(|err| format_err!("failed to execute '{}' - {}", PVS_BIN_PATH, err))?; - - let output = crate::tools::command_output(output, None) - .map_err(|err| format_err!("pvs command failed: {}", err))?; + let output = crate::tools::run_command(command, None)?; let mut device_set: HashSet = HashSet::new(); diff --git a/src/tools/disks/smart.rs b/src/tools/disks/smart.rs index 3928edc6..64b2ac89 100644 --- a/src/tools/disks/smart.rs +++ b/src/tools/disks/smart.rs @@ -88,11 +88,7 @@ pub fn get_smart_data( }; command.arg(disk_path); - let output = command.output() - .map_err(|err| format_err!("failed to execute '{}' - {}", SMARTCTL_BIN_PATH, err))?; - - let output = crate::tools::command_output(output, None) - .map_err(|err| format_err!("smartctl command failed: {}", err))?; + let output = crate::tools::run_command(command, None)?; let output: serde_json::Value = output.parse()?; diff --git a/src/tools/disks/zfs.rs b/src/tools/disks/zfs.rs index 47dfffb8..e287f7ab 100644 --- a/src/tools/disks/zfs.rs +++ b/src/tools/disks/zfs.rs @@ -185,11 +185,7 @@ pub fn zfs_devices( if let Some(pool) = pool { command.arg(pool); } - let output = command.output() - .map_err(|err| format_err!("failed to execute '/sbin/zpool' - {}", err))?; - - let output = crate::tools::command_output(output, None) - .map_err(|err| format_err!("zpool list command failed: {}", err))?; + let output = crate::tools::run_command(command, None)?; let list = parse_zfs_list(&output)?;