From 0d8cb2dba2cd17531a51b0d0fc58d0c211c40325 Mon Sep 17 00:00:00 2001 From: River Date: Wed, 4 Jan 2023 23:16:31 -0500 Subject: [PATCH] Fixed GPU support on linux. --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 70c956b..0d961a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -95,12 +95,13 @@ impl InformationStruct { } } _ => { - let command_output = std::process::Command::new("lspci").args(["|", "grep", "VGA", "|", "cut", "-d", "\":\"", "-f3"]).output(); + let command_output = std::process::Command::new("bash").args(["-c", "lspci | grep VGA | cut -d \":\" -f3"]).output(); let gpu = match command_output { - Ok(gpu_info) => Some(String::from_utf8(gpu_info.stdout).unwrap()), + Ok(gpu_info) => Some(String::from_utf8(gpu_info.stdout).unwrap().trim().to_owned()), Err(_) => None, }; if gpu == Some(String::from("")) { + println!("GPU: {}", gpu.unwrap()); None } else { gpu