diff --git a/core/src/modes.rs b/core/src/modes.rs index 981cb26..58d5974 100644 --- a/core/src/modes.rs +++ b/core/src/modes.rs @@ -27,14 +27,7 @@ pub fn suggestion(data: &mut Data) { return; } else { data.update_command(&data.suggest.clone().unwrap()); - let msg = Some( - execution - .err() - .unwrap() - .split_whitespace() - .collect::>() - .join(" "), - ); + let msg = Some(execution.err().unwrap()); data.update_error(msg); let retry_message = format!("{}...", t!("retry")); @@ -94,14 +87,7 @@ pub fn cnf(data: &mut Data) { if status.is_err() { let suggest = data.suggest.clone().unwrap(); data.update_command(&suggest); - let msg = Some( - status - .err() - .unwrap() - .split_whitespace() - .collect::>() - .join(" "), - ); + let msg = Some(status.err().unwrap()); data.update_error(msg); let retry_message = format!("{}...", t!("retry")); eprintln!("\n{}\n", retry_message.cyan().bold()); diff --git a/core/src/shell.rs b/core/src/shell.rs index d69610c..79c9c9d 100644 --- a/core/src/shell.rs +++ b/core/src/shell.rs @@ -219,7 +219,7 @@ impl Data { pub fn update_error(&mut self, error: Option) { if let Some(error) = error { - self.error = error; + self.error = error.to_lowercase().split_whitespace().collect::>().join(" "); } else { self.error = get_error(&self.shell, &self.command); } @@ -271,7 +271,7 @@ pub fn get_error(shell: &str, command: &str) -> String { } else { error_output_threaded(shell, command) }; - error.split_whitespace().collect::>().join(" ") + error.to_lowercase().split_whitespace().collect::>().join(" ") } pub fn error_output_threaded(shell: &str, command: &str) -> String { @@ -293,8 +293,8 @@ pub fn error_output_threaded(shell: &str, command: &str) -> String { match receiver.recv_timeout(Duration::from_secs(3)) { Ok(output) => match output.stderr.is_empty() { - true => String::from_utf8_lossy(&output.stdout).to_lowercase(), - false => String::from_utf8_lossy(&output.stderr).to_lowercase(), + true => String::from_utf8_lossy(&output.stdout).to_string(), + false => String::from_utf8_lossy(&output.stderr).to_string(), }, Err(_) => { use colored::*;