From 61256e4acb9fb6bcc2e9fd96d57e73de746aa21c Mon Sep 17 00:00:00 2001 From: pulsareonbot Date: Tue, 7 Jul 2026 13:33:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(Live2D):=20Firefox=20kiosk=20=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E6=B8=85=E7=90=86=E7=94=A8=20pkill=20=E5=85=9C?= =?UTF-8?q?=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Firefox esr 会 fork 子进程,child.kill() 只杀父进程导致残留。 三处清理(ConfigReloaded live2d 分支/切回视频分支/stop)都加 pkill -f live2d-display.html 兜底。 --- src/plugins/video/mod.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/video/mod.rs b/src/plugins/video/mod.rs index 0c4f745..0bab18f 100644 --- a/src/plugins/video/mod.rs +++ b/src/plugins/video/mod.rs @@ -214,6 +214,10 @@ impl Plugin for VideoPlugin { let _ = child.kill(); let _ = child.wait(); } + let _ = std::process::Command::new("pkill") + .arg("-f") + .arg("live2d-display.html") + .output(); // 启动 Firefox kiosk 模式全屏显示 Live2D let port = config.remote_control.port; let url = format!("http://localhost:{port}/live2d-display.html"); @@ -242,8 +246,13 @@ impl Plugin for VideoPlugin { if let Some(mut child) = self.live2d_child.take() { let _ = child.kill(); let _ = child.wait(); - println!("[VideoPlugin] 切回视频模式:Firefox kiosk 已关闭"); } + // Firefox 会 fork 子进程,child.kill() 只杀父进程,用 pkill 兜底 + let _ = std::process::Command::new("pkill") + .arg("-f") + .arg("live2d-display.html") + .output(); + println!("[VideoPlugin] 切回视频模式:Firefox kiosk 已关闭"); let processor = Arc::new(Mutex::new(VideoProcessor::new(config)?)); if let Some(old) = self.processor.replace(Arc::clone(&processor)) { @@ -295,6 +304,10 @@ impl Plugin for VideoPlugin { let _ = child.kill(); let _ = child.wait(); } + let _ = std::process::Command::new("pkill") + .arg("-f") + .arg("live2d-display.html") + .output(); self.publish_status(); Ok(())