diff --git a/startscript-cluster1.js b/startscript-cluster1.js index a1c03b69..cab38749 100644 --- a/startscript-cluster1.js +++ b/startscript-cluster1.js @@ -1,2 +1,10 @@ -var exec = require('child_process').exec -exec('yarn start:cluster1', { windowsHide: true }) +const { spawn } = require('child_process') +const child = spawn('yarn start:cluster1', { stdio: 'inherit', windowsHide: true, shell: true }) +child.on('exit', (code, signal) => { + console.log(`[wrapper] yarn start:cluster1 exited code=${code} signal=${signal}`) + process.exit(code ?? 1) +}) +child.on('error', (err) => { + console.error('[wrapper] spawn error:', err) + process.exit(1) +}) diff --git a/startscript-cluster2.js b/startscript-cluster2.js index 20fc5f42..f9905f54 100644 --- a/startscript-cluster2.js +++ b/startscript-cluster2.js @@ -1,2 +1,10 @@ -var exec = require('child_process').exec -exec('yarn start:cluster2', { windowsHide: true }) +const { spawn } = require('child_process') +const child = spawn('yarn start:cluster2', { stdio: 'inherit', windowsHide: true, shell: true }) +child.on('exit', (code, signal) => { + console.log(`[wrapper] yarn start:cluster2 exited code=${code} signal=${signal}`) + process.exit(code ?? 1) +}) +child.on('error', (err) => { + console.error('[wrapper] spawn error:', err) + process.exit(1) +}) diff --git a/startscript-dev.js b/startscript-dev.js index 31300d78..971d9614 100644 --- a/startscript-dev.js +++ b/startscript-dev.js @@ -1,2 +1,10 @@ -var exec = require('child_process').exec -exec('yarn start:dev', { windowsHide: true }) +const { spawn } = require('child_process') +const child = spawn('yarn start:dev', { stdio: 'inherit', windowsHide: true, shell: true }) +child.on('exit', (code, signal) => { + console.log(`[wrapper] yarn start:dev exited code=${code} signal=${signal}`) + process.exit(code ?? 1) +}) +child.on('error', (err) => { + console.error('[wrapper] spawn error:', err) + process.exit(1) +})