From 9f6ba7e6190af1e099d7f0cac48c9aa240e45748 Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Thu, 3 Jan 2019 10:49:42 -0500 Subject: [PATCH] an exec_cmdline function which suppresses all output --- libcitadel/src/util.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libcitadel/src/util.rs b/libcitadel/src/util.rs index 448ed2e..8623337 100644 --- a/libcitadel/src/util.rs +++ b/libcitadel/src/util.rs @@ -27,6 +27,18 @@ pub fn exec_cmdline>(cmd_path: &str, args: S) -> Result<()> { check_cmd_status(cmd_path, &status) } +pub fn exec_cmdline_quiet>(cmd_path: &str, args: S) -> Result<()> { + ensure_command_exists(cmd_path)?; + let args: Vec<&str> = args.as_ref().split_whitespace().collect::>(); + let status = Command::new(cmd_path) + .args(args) + .stderr(Stdio::null()) + .stdout(Stdio::null()) + .status()?; + + check_cmd_status(cmd_path, &status) +} + pub fn exec_cmdline_with_output>(cmd_path: &str, args: S) -> Result { ensure_command_exists(cmd_path)?; let args: Vec<&str> = args.as_ref().split_whitespace().collect::>();