From 5cc22aa90bdd65afd938bdc5154c10b7f838c07e Mon Sep 17 00:00:00 2001 From: rafapaezbas Date: Tue, 22 Oct 2024 12:15:54 +0200 Subject: [PATCH] store pipe process reference and term on exit --- gui/gui.js | 6 ++++++ lib/worker.js | 1 + 2 files changed, 7 insertions(+) diff --git a/gui/gui.js b/gui/gui.js index 27024ecb0..a54889185 100644 --- a/gui/gui.js +++ b/gui/gui.js @@ -1529,6 +1529,12 @@ class PearGUI extends ReadyResource { } pipe.write(data) }) + + electron.app.once('will-quit', () => { + for (const pipe of this.pipes) { + pipe.sp.kill('SIGTERM') + } + }) } async app () { diff --git a/lib/worker.js b/lib/worker.js index 75978c7d7..b7e3cdf07 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -51,6 +51,7 @@ class Worker { this.#unref() }) const pipe = sp.stdio[3] + pipe.sp = sp return pipe }