feat: improve shutdown cleanup

This commit is contained in:
Johannes Millan 2025-06-29 17:31:28 +02:00
parent 92b4d5409b
commit fcf5e5fe30
6 changed files with 69 additions and 14 deletions

View file

@ -192,6 +192,12 @@ class PluginNodeExecutor {
const timer = setTimeout(() => {
killed = true;
child.kill('SIGTERM');
// Force kill after a short delay if process doesn't terminate
setTimeout(() => {
if (!child.killed) {
child.kill('SIGKILL');
}
}, 1000);
reject(new Error(`Script execution timed out after ${timeoutMs}ms`));
}, timeoutMs);