From 64e9c3f1ea7f83c6a6390bd83d5c6e7681310be4 Mon Sep 17 00:00:00 2001 From: Cno Date: Mon, 5 Aug 2024 23:12:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types/steps/kill.rs | 2 +- src/utils/process.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types/steps/kill.rs b/src/types/steps/kill.rs index 8ebb625c..751ce19d 100644 --- a/src/types/steps/kill.rs +++ b/src/types/steps/kill.rs @@ -27,7 +27,7 @@ fn kill(target: &String) -> Result<()> { let s = System::new_all(); let mut count_suc = 0; let mut count_fail = 0; - for process in s.processes_by_exact_name(target) { + for process in s.processes_by_exact_name(target.as_ref()) { if process.kill() { count_suc += 1; } else { diff --git a/src/utils/process.rs b/src/utils/process.rs index c45b8fe6..236f3b1f 100644 --- a/src/utils/process.rs +++ b/src/utils/process.rs @@ -3,7 +3,7 @@ use sysinfo::System; pub fn kill_with_name(name: &str) -> bool { let s = System::new_all(); let mut res = true; - for process in s.processes_by_exact_name(name) { + for process in s.processes_by_exact_name(name.as_ref()) { if !process.kill() { res = false; } @@ -13,7 +13,7 @@ pub fn kill_with_name(name: &str) -> bool { pub fn is_alive_with_name(name: &str) -> bool { let s = System::new_all(); - let mut processes = s.processes_by_exact_name(name); + let mut processes = s.processes_by_exact_name(name.as_ref()); processes.next().is_some() }