Compare commits

..

No commits in common. "main" and "v9.0.2" have entirely different histories.
main ... v9.0.2

View File

@ -1190,23 +1190,7 @@ function speakWithPiper(
}) })
} }
/**
* 每轮播报结束时统一调用。之前只是把 currentProcess/currentPlayer 引用置空,
* 没有保证对应的系统进程真的退出——真机复测时发现合成卡死分支(见上面
* "synth timeout" 处)只杀了 vitsWorker,没杀已经 spawn 出来、stdin 还开着
* 干等数据的 aplay,这个进程会永远卡在那等一个再也不会来的 EOF,形成和
* PLAYER_EXIT_TIMEOUT_MS 要解决的问题同一性质的泄漏,只是触发路径不同。
* 与其在每个 done() 调用点各自记得去杀 currentPlayer,不如在 cleanup()
* 这个唯一的收尾出口统一兜底:无论从哪条路径走到这里,都先尝试杀掉还活着
* 的进程,再清空引用。
*/
function cleanup(): void { function cleanup(): void {
if (currentProcess) {
killWithEscalation(currentProcess)
}
if (currentPlayer) {
killWithEscalation(currentPlayer)
}
currentProcess = null currentProcess = null
currentPlayer = null currentPlayer = null
isSpeaking = false isSpeaking = false