From 4ab6204760ad28cc63460763f06009faf406bd2b Mon Sep 17 00:00:00 2001 From: Shivangi Das Date: Tue, 19 Mar 2024 12:06:06 +0000 Subject: [PATCH] chore(cb2-11221): try exec with logging --- scripts/setup.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/setup.ts b/scripts/setup.ts index ddf1cd23e..286db9fbe 100644 --- a/scripts/setup.ts +++ b/scripts/setup.ts @@ -1,4 +1,4 @@ -import { spawn } from 'child_process'; +import { exec } from 'child_process'; // We hook to serverless offline when firing its process const SERVER_OK = `Server ready: http://localhost:3006 🚀`; @@ -37,7 +37,14 @@ const setupServer = (process: any) => new Promise((resolve, reject) => { }); }); -const server = spawn('npm', ['run', 'start', '&'], {}); +const server = exec('npm run start &', (error, stdout, stderr) => { + if (error) { + console.error(`exec error: ${error}`); + return; + } + console.log(`stdout: ${stdout}`); + console.error(`stderr: ${stderr}`); +}); module.exports = async () => { console.log(`\nSetting up Integration tests...\n\n`);