From f14a1c1ea7a246493d8af3132eaa6a79d822f2d2 Mon Sep 17 00:00:00 2001 From: iff Date: Sun, 8 Dec 2024 11:19:54 +0100 Subject: [PATCH] fix: use stderr if stdout is empty --- src/shell.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell.rs b/src/shell.rs index 36b0982..959885d 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -235,7 +235,10 @@ pub fn command_output(shell: &str, command: &str) -> String { .output() .expect("failed to execute process"); - String::from_utf8_lossy(&output.stdout).to_string() + match output.stdout.is_empty() { + false => String::from_utf8_lossy(&output.stdout).to_lowercase(), + true => String::from_utf8_lossy(&output.stderr).to_lowercase(), + } } pub fn last_command(shell: &str) -> String {