stop crash error

This commit is contained in:
jenz 2026-07-03 15:15:30 +01:00
parent 208a478440
commit b0637705f0

View File

@ -247,6 +247,12 @@ function startPacat(browserSessId) {
console.log(`[pacat:${browserSessId}] exited with code ${code}`); console.log(`[pacat:${browserSessId}] exited with code ${code}`);
pacatProcesses.delete(browserSessId); pacatProcesses.delete(browserSessId);
}); });
// Prevent EPIPE from crashing the server when pacat exits while we're
// still writing to its stdin (e.g. mic frames arriving after disconnect).
pacat.stdin.on('error', err => {
if (err.code !== 'EPIPE') console.error(`[pacat:${browserSessId}] stdin error: ${err.message}`);
pacatProcesses.delete(browserSessId);
});
pacatProcesses.set(browserSessId, pacat); pacatProcesses.set(browserSessId, pacat);
return pacat; return pacat;
} }