chore: use .once instead of .on

This commit is contained in:
草鞋没号 2022-05-28 17:54:34 +08:00
parent 5e0cf0bd4a
commit 694f51fc9a

View File

@ -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()