From 694f51fc9ab73b49d1e9d84a27fe5e619030a3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Sat, 28 May 2022 17:54:34 +0800 Subject: [PATCH] chore: use `.once` instead of `.on` --- scripts/watch.mjs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/watch.mjs b/scripts/watch.mjs index e9ad855..c73473b 100644 --- a/scripts/watch.mjs +++ b/scripts/watch.mjs @@ -39,11 +39,10 @@ function watchMain(server) { if (electronProcess) { electronProcess.removeAllListeners() electronProcess.kill() - electronProcess = null } electronProcess = spawn(electron, ['.'], { env }) - electronProcess.on('exit', process.exit) + electronProcess.once('exit', process.exit) // https://github.com/electron-vite/electron-vite-vue/pull/129 electronProcess.stdout.on('data', (data) => { const str = data.toString().trim()