open-cli-tools / concurrently

Run commands concurrently. Like `npm run watch-js & npm run watch-less` but better.
https://www.npmjs.com/package/concurrently
MIT License
6.98k stars 227 forks source link

on sending --kill-others process ng serve close with exit code 1 - Still a problem #481

Closed ramialkheshan closed 3 months ago

ramialkheshan commented 3 months ago

Hello! I have the next problem and this is my steps for reproduce: 1) I have main package.json where

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "stop": "taskkill -f -im node* && exit 0",
    "start4tests": "node ./src/scripts/runNgServeForTests.ts",
    "build": "ng build",
    "**test:integration**": "concurrently --kill-others --kill-signal SIGKILL --success all \"npm run start4tests\" \"wait-on http://localhost:4200/ && cd ./tests/wdio && npm install && npm run test:integration\"",

2) On my another package.json on test project I have this:

"test:integration": "cross-env TT_ENV=LOCAL wdio run ./config/wdio.integration.conf.ts",

3) In file ./src/scripts/runNgServeForTests.ts I have next code:

const { spawn } = require('child_process');

const ngServe = spawn('ng', ['serve', '--configuration=test'], { shell: true });

process.on('SIGINT', () => {
  console.log('SIGINT signal received. Shutting down gracefully...');
  ngServe.kill('SIGINT');
  process.exit(0);
});

ngServe.on('close', () => {
  process.exit(0);
});

And After running command /npm run test:integration

I got next result in my terminal

image

By the way I have tested without --kill-signal SIGKILL and result was the same

Could you help me understand how I can close ng serve process with exited code 0 ?

gustavohenke commented 3 months ago

Try setting the --success flag, it allows you to set which process(es) you want to infer the exit code 0 from.

ramialkheshan commented 3 months ago

--success

Sorry, this flag present in my command with value all. So maybe you will advice to me something else. I will be very grateful image