From 2df12109a5fa2da76a7e1fb1bba7b3885ed499ad Mon Sep 17 00:00:00 2001 From: luch <32321690+luch1994@users.noreply.github.com> Date: Tue, 19 Dec 2023 19:25:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9windows=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98=20(#28)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/scripts/run-local.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/scripts/run-local.ts b/server/scripts/run-local.ts index e5245ebf..7e954d55 100644 --- a/server/scripts/run-local.ts +++ b/server/scripts/run-local.ts @@ -9,7 +9,10 @@ async function startServerAndRunScript() { console.log('MongoDB Memory Server started:', mongoUri); // 通过 spawn 运行另一个脚本,并传递 MongoDB 连接 URL 作为环境变量 - const tsnode = spawn('cross-env', [`xiaojuSurveyMongoUrl="${mongoUri}"`, 'npx', 'ts-node-dev', './src/index.ts']) + const tsnode = spawn('cross-env', [`xiaojuSurveyMongoUrl="${mongoUri}"`, 'npx', 'ts-node-dev', './src/index.ts'], { + stdio: 'inherit', + shell: process.platform === 'win32' + }); tsnode.stdout?.on('data', (data) => { console.log(data.toString()); });