fix(Live2D): Firefox kiosk 进程清理用 pkill 兜底
Firefox esr 会 fork 子进程,child.kill() 只杀父进程导致残留。 三处清理(ConfigReloaded live2d 分支/切回视频分支/stop)都加 pkill -f live2d-display.html 兜底。
This commit is contained in:
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user