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

How to distinguish which process the output stream line comes from #468

Open LookRain opened 6 months ago

LookRain commented 6 months ago

I have a output stream looking like this, however it doesn't work reliably because some lines simply do not have a prefix.

const outputStream = {
  write: (data) => {
    if (['[SDK]', '[bundle]', '[dts]'].some((str) => data.includes(str))) {
      sdkStream.write(data);
    } else if (data.includes('[Demo App]')) {
      demoStream.write(data);
    }
  },
};

May I know if there's any way I can tell reliably which process a line is coming form? Many thanks!

gustavohenke commented 6 months ago

Not really. What you have is the best way right now.

However, we can change the output stream to have the command object alongside the text. This would be a breaking change though.

PRs welcome, should be an easy change!