From d800d850eafd7935f7f16f85d7166ceaa040027c Mon Sep 17 00:00:00 2001 From: lzdyes Date: Fri, 13 May 2022 22:36:34 +0800 Subject: [PATCH 1/2] feat: add CTRL + C exit the application without ask --- scripts/watch.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/watch.mjs b/scripts/watch.mjs index 7d52780..0c5dce9 100644 --- a/scripts/watch.mjs +++ b/scripts/watch.mjs @@ -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' }) From 324e0cf37f6f35e560333629becea3febf23a706 Mon Sep 17 00:00:00 2001 From: lzdyes Date: Fri, 13 May 2022 23:16:04 +0800 Subject: [PATCH 2/2] docs: modify comments --- scripts/watch.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/watch.mjs b/scripts/watch.mjs index 0c5dce9..a78cecd 100644 --- a/scripts/watch.mjs +++ b/scripts/watch.mjs @@ -59,7 +59,7 @@ function watchPreload(server) { }) } -// block CTRL + C to exit the application directly without displaying the query in Windows +// 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) }