From 8c598e50b769cd8e6f854a82d90ca2a3d42acaa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Sat, 24 Aug 2024 02:38:37 +0800 Subject: [PATCH] =?UTF-8?q?Update:=20=E6=9B=B4=E6=96=B0Mixly.Electron.Shel?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/modules/mixly-modules/electron/shell.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/modules/mixly-modules/electron/shell.js b/common/modules/mixly-modules/electron/shell.js index 993fc9b5..50b4d5c7 100644 --- a/common/modules/mixly-modules/electron/shell.js +++ b/common/modules/mixly-modules/electron/shell.js @@ -21,6 +21,7 @@ class Shell { } #shell_ = null; + #killed_ = false; constructor() {} #addEventsListener_() { @@ -60,6 +61,10 @@ class Shell { }); this.#addEventsListener_(); this.#shell_.on('close', (code) => { + this.#killed_ = true; + if (code === null) { + code = 1; + } const endTime = Number(new Date()); const duration = dayjs.duration(endTime - startTime).format('HH:mm:ss.SSS'); const info = { code, time: duration }; @@ -69,6 +74,9 @@ class Shell { } kill() { + if (this.#killed_) { + return; + } this.#shell_.stdin.end(); this.#shell_.stdout.end(); if (Env.currentPlatform === 'win32') {