pub(crate) fn run_command_get_output(
    command_string: &str,
    args: &Option<Vec<String>>,
    capture_output: bool,
) -> io::Result<Output> {
    let ctrl_c_handling = UnstableFeature::CtrlCHandling.is_env_set();
    let silent = is_silent();

    debug!("Execute Command: {}", &command_string);
    let mut command = Command::new(&command_string);

    match *args {
        Some(ref args_vec) => {
            command.args(args_vec);
        }
        None => debug!("No command args defined."),
    };

    command.stdin(Stdio::inherit());

    if silent {
        command.stdout(Stdio::null()).stderr(Stdio::null());
    } else if ctrl_c_handling {
        if capture_output {
            command.stdout(Stdio::piped()).stderr(Stdio::piped());
        }
    } else if !capture_output {
        command.stdout(Stdio::inherit()).stderr(Stdio::inherit());
    }

    info!("Execute Command: {:?}", &command);

    let output = if ctrl_c_handling {
        spawn_command(command)
    } else {
        command.output()
    };

    debug!("Output: {:#?}", &output);

    output
}
Runs the requested command and return its output.
src/lib/command.rs