fix: 修改windows启动兼容问题 (#28)

This commit is contained in:
luch 2023-12-19 19:25:08 +08:00 committed by GitHub
parent 797c484475
commit 2df12109a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,10 @@ async function startServerAndRunScript() {
console.log('MongoDB Memory Server started:', mongoUri); console.log('MongoDB Memory Server started:', mongoUri);
// 通过 spawn 运行另一个脚本,并传递 MongoDB 连接 URL 作为环境变量 // 通过 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) => { tsnode.stdout?.on('data', (data) => {
console.log(data.toString()); console.log(data.toString());
}); });