Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrently crashes leaving processes running when piping command exits #230

Open
idrise opened this issue Jun 13, 2020 · 3 comments
Open

Comments

@idrise
Copy link

idrise commented Jun 13, 2020

Recreate

concurrently --kill-others -n api,ui \"nx serve api\" \"nx serve ui\" | lnav -t

Then press q to quit lnav and this error is reported and both API and UI continue to be served in the background.
It would be great if concurrently shut down when the write stream is destroyed.

    setTimeout(function () { throw err; }, 0);
                             ^

Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at Socket.Writable.write (_stream_writable.js:322:17)
    at Logger.log (***/node_modules/concurrently/src/logger.js:107:27)
    at Logger.logCommandText (***/node_modules/concurrently/src/logger.js:74:21)
    at Logger.logCommandEvent (***/node_modules/concurrently/src/logger.js:69:14)
    at SafeSubscriber._next (***/node_modules/concurrently/src/flow-control/log-exit.js:8:25)
    at SafeSubscriber.__tryOrUnsub (***/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.next (***/node_modules/rxjs/internal/Subscriber.js:143:22)
    at Subscriber._next (***/node_modules/rxjs/internal/Subscriber.js:89:26)
    at Subscriber.next (***/node_modules/rxjs/internal/Subscriber.js:66:18)
    at Subject.next (***/node_modules/rxjs/internal/Subject.js:60:25)
Emitted 'error' event on Socket instance at:
    at errorOrDestroy (internal/streams/destroy.js:128:12)
    at Socket.Writable.write (_stream_writable.js:324:5)
    at Logger.log (***/node_modules/concurrently/src/logger.js:107:27)
    [... lines matching original stack trace ...]
    at Subscriber.next (***/node_modules/rxjs/internal/Subscriber.js:66:18) {
  code: 'ERR_STREAM_DESTROYED'
}```


@idrise idrise closed this as completed Jun 13, 2020
@idrise idrise reopened this Jun 13, 2020
@gustavohenke
Copy link
Member

Hey @idrise! Thanks for the report. Sounds like an easy fix.

@gustavohenke
Copy link
Member

I was looking at this issue - while it does indeed seem like an easy fix, I'm not sure which feedback should concurrently provide.
It'd be nice to print the usual "blabla exited with ", however everything goes to stdout. Switching to stderr for the final messages is probably not desirable.
Maybe print some kind of error message instead?

@idrise
Copy link
Author

idrise commented Jul 22, 2024

I think a clean exit, killing the running processes makes the most sense IMHO.
Could be that any throw ends up leaving processes hanging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants