mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-02-26 13:00:09 +08:00
feat: add CTRL + C exit the application without ask
This commit is contained in:
parent
00866022a2
commit
d800d850ea
@ -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' })
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user