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
7.15k stars 233 forks source link

Always exits 0 in monorepo #499

Closed saiichihashimoto closed 1 month ago

saiichihashimoto commented 3 months ago

When running concurrently from a monorepo workspace, all commands exit 0.

From the root, things are fine:

package.json:

...
    "explicitfail": "concurrently npm:explicitfail:*",
    "explicitfail:fail": "exit 1",
...

Command:

npm run explicitfail && echo shouldnt show

Output:

> explicitfail
> concurrently npm:explicitfail:*

[fail] 
[fail] > explicitfail:fail
[fail] > exit 1
[fail] 
[fail] npm run explicitfail:fail exited with code 1

However, when I cd into packages/subpackage and have the same setup, it succeeds:

packages/subpackage/package.json: (same thing)

...
    "explicitfail": "concurrently npm:explicitfail:*",
    "explicitfail:fail": "exit 1",
...

Command:

npm run explicitfail && echo shouldnt show

Output:

> @monorepo/subpackage@0.0.0-development explicitfail
> concurrently npm:explicitfail:*

[fail] 
[fail] > @monorepo/subpackage@0.0.0-development explicitfail:fail
[fail] > exit 1
[fail] 
[fail] npm ERR! Lifecycle script `explicitfail:fail` failed with error: 
[fail] npm ERR! Error: command failed 
npm ERR!   in workspace: @monorepo/subpackage@0.0.0-development 
npm ERR!   at location: /path/to/repo/monorepo/packages/subpackage 
[fail] npm run explicitfail:fail exited with code 0
shouldnt show
gustavohenke commented 3 months ago

Interesting. Are you able to share a self-contained example repository?

saiichihashimoto commented 1 month ago

I believe this was related to a turbo issue, so I think we're good here