Skip to content

Commit 41eafc6

Browse files
authored
Merge pull request #126 from lzdyes/main
feat: add CTRL + C exit the application without ask
2 parents 0086602 + 324e0cf commit 41eafc6

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 the CTRL + C shortcut on a Windows terminal and exit the application without displaying a query
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)