mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
Merge pull request #126 from lzdyes/main
feat: add CTRL + C exit the application without ask
This commit is contained in:
commit
41eafc6252
@ -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 the CTRL + C shortcut on a Windows terminal and exit the application without displaying a query
|
||||
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