From 75b5e3754ec57ea660859d6bc29cf1a92543f75d Mon Sep 17 00:00:00 2001 From: lzdyes Date: Mon, 16 May 2022 14:45:52 +0800 Subject: [PATCH] fix: print Chinese characters are garbled in Windows terminal --- scripts/watch.mjs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/watch.mjs b/scripts/watch.mjs index fe65433..8cd91b1 100644 --- a/scripts/watch.mjs +++ b/scripts/watch.mjs @@ -42,8 +42,16 @@ function watchMain(server) { electronProcess = null } - electronProcess = spawn(electron, ['.'], { stdio: 'inherit', env }) + electronProcess = spawn(electron, ['.'], { env }) electronProcess.on('exit', process.exit) + electronProcess.stdout.on('data', (data) => { + const str = data.toString().trim() + str && console.log(str) + }) + electronProcess.stderr.on('data', (data) => { + const str = data.toString().trim() + str && console.error(str) + }) }, }