feat: add CTRL + C exit the application without ask

This commit is contained in:
lzdyes 2022-05-13 22:36:34 +08:00
parent 00866022a2
commit d800d850ea
No known key found for this signature in database
GPG Key ID: 2FE62F8D86CEB3C5

View File

@ -1,6 +1,7 @@
import { spawn } from 'child_process'
import { createServer, build } from 'vite'
import electron from 'electron'
import readline from 'readline'
const query = new URLSearchParams(import.meta.url.split('?')[1])
const debug = query.has('debug')
@ -58,6 +59,11 @@ function watchPreload(server) {
})
}
// block CTRL + C to exit the application directly without displaying the query in Windows
if (process.platform === 'win32') {
readline.createInterface({ input: process.stdin, output: process.stdout }).on('SIGINT', process.exit)
}
// bootstrap
const server = await createServer({ configFile: 'packages/renderer/vite.config.ts' })