fix(Live2D): Firefox kiosk 进程清理用 pkill 兜底

Firefox esr 会 fork 子进程,child.kill() 只杀父进程导致残留。
三处清理(ConfigReloaded live2d 分支/切回视频分支/stop)都加
pkill -f live2d-display.html 兜底。
This commit is contained in:
2026-07-07 13:33:59 +08:00
parent 77d788d7a5
commit 61256e4acb

View File

@@ -214,6 +214,10 @@ impl Plugin for VideoPlugin {
let _ = child.kill(); let _ = child.kill();
let _ = child.wait(); let _ = child.wait();
} }
let _ = std::process::Command::new("pkill")
.arg("-f")
.arg("live2d-display.html")
.output();
// 启动 Firefox kiosk 模式全屏显示 Live2D // 启动 Firefox kiosk 模式全屏显示 Live2D
let port = config.remote_control.port; let port = config.remote_control.port;
let url = format!("http://localhost:{port}/live2d-display.html"); 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() { if let Some(mut child) = self.live2d_child.take() {
let _ = child.kill(); let _ = child.kill();
let _ = child.wait(); 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)?)); let processor = Arc::new(Mutex::new(VideoProcessor::new(config)?));
if let Some(old) = self.processor.replace(Arc::clone(&processor)) { if let Some(old) = self.processor.replace(Arc::clone(&processor)) {
@@ -295,6 +304,10 @@ impl Plugin for VideoPlugin {
let _ = child.kill(); let _ = child.kill();
let _ = child.wait(); let _ = child.wait();
} }
let _ = std::process::Command::new("pkill")
.arg("-f")
.arg("live2d-display.html")
.output();
self.publish_status(); self.publish_status();
Ok(()) Ok(())