From 9637bdd3234867b4d36caa700c2a4062aadb6881 Mon Sep 17 00:00:00 2001 From: pulsareonbot Date: Tue, 7 Jul 2026 14:50:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(Live2D):=20=E7=94=A8=20bash=20kill=20-9=20\?= =?UTF-8?q?=20=E6=9B=BF=E4=BB=A3=20pkill=EF=BC=88pkill=20=E4=BB=8E=20Rust?= =?UTF-8?q?=20=E6=89=A7=E8=A1=8C=E4=B8=8D=E7=94=9F=E6=95=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/video/mod.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/plugins/video/mod.rs b/src/plugins/video/mod.rs index cd8b01b..97f0662 100644 --- a/src/plugins/video/mod.rs +++ b/src/plugins/video/mod.rs @@ -214,11 +214,10 @@ impl Plugin for VideoPlugin { let _ = child.kill(); let _ = child.wait(); } - // Firefox 会 fork 多个子进程,child.kill() 只杀父进程,用 pkill -9 兜底 - let _ = std::process::Command::new("/usr/bin/pkill") - .arg("-9") - .arg("-f") - .arg("firefox-esr") + // Firefox 会 fork 多个子进程,用 shell kill -9 杀整个进程树 + let _ = std::process::Command::new("/bin/bash") + .arg("-c") + .arg("kill -9 $(pgrep firefox-esr) 2>/dev/null") .output(); // 启动 Firefox kiosk 模式全屏显示 Live2D let port = config.remote_control.port; @@ -249,11 +248,10 @@ impl Plugin for VideoPlugin { let _ = child.kill(); let _ = child.wait(); } - // Firefox 会 fork 多个子进程,child.kill() 只杀父进程,用 pkill -9 兜底 - let _ = std::process::Command::new("/usr/bin/pkill") - .arg("-9") - .arg("-f") - .arg("firefox-esr") + // Firefox 会 fork 多个子进程,用 shell kill -9 杀整个进程树 + let _ = std::process::Command::new("/bin/bash") + .arg("-c") + .arg("kill -9 $(pgrep firefox-esr) 2>/dev/null") .output(); println!("[VideoPlugin] 切回视频模式:Firefox kiosk 已关闭"); @@ -307,10 +305,9 @@ impl Plugin for VideoPlugin { let _ = child.kill(); let _ = child.wait(); } - let _ = std::process::Command::new("/usr/bin/pkill") - .arg("-9") - .arg("-f") - .arg("firefox-esr") + let _ = std::process::Command::new("/bin/bash") + .arg("-c") + .arg("kill -9 $(pgrep firefox-esr) 2>/dev/null") .output(); self.publish_status();