From 6658838598ab83a94cbecc505de7f21600f33b77 Mon Sep 17 00:00:00 2001 From: Genadi Date: Sat, 22 Apr 2023 02:00:59 +0300 Subject: [PATCH] fix clean exit of process --- lib/converter.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/converter.js b/lib/converter.js index 7178cade..5bb4dcac 100644 --- a/lib/converter.js +++ b/lib/converter.js @@ -656,13 +656,16 @@ function detectLibreOffice (additionalPaths) { detectLibreOffice(); -['SIGINT', 'SIGHUP', 'SIGQUIT'].forEach(function (signal) { - process.on(signal, function () { - converter.exit(); - }); +['SIGINT', 'SIGHUP', 'SIGQUIT'].forEach((signal) => { + const cleanup = () => { + converter.exit(() => { + process.removeListener(signal, cleanup); + process.kill(process.pid, signal); + }); + } + process.on(signal, cleanup); }); - process.on('exit', function () { converter.exit(); });