Skip to content

Commit d800d85

Browse files
committed
feat: add CTRL + C exit the application without ask
1 parent 0086602 commit d800d85

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/watch.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { spawn } from 'child_process'
22
import { createServer, build } from 'vite'
33
import electron from 'electron'
4+
import readline from 'readline'
45

56
const query = new URLSearchParams(import.meta.url.split('?')[1])
67
const debug = query.has('debug')
@@ -58,6 +59,11 @@ function watchPreload(server) {
5859
})
5960
}
6061

62+
// block CTRL + C to exit the application directly without displaying the query in Windows
63+
if (process.platform === 'win32') {
64+
readline.createInterface({ input: process.stdin, output: process.stdout }).on('SIGINT', process.exit)
65+
}
66+
6167
// bootstrap
6268
const server = await createServer({ configFile: 'packages/renderer/vite.config.ts' })
6369

0 commit comments

Comments
 (0)