There’s a Nodejs utility, concurrently, which can be used to execute several commands at once, and it prefixes each one’s output with a tag. For example:
npx concurrently -n "frontend,backend" "launch_frontend.sh" "launch_backend.sh"
When used on Linux, stdout of the children point to a socket, whereas on Macos stdout remains file descriptor 1.
This means that the following command succeeds on Macos, but fails on Linux:
npx concurrently "echo 'hello world' > /dev/stdout"
However this command succeeds on both:
echo 'hello world' > /dev/stdout
Under concurrently
on Linux /dev/stdout
points to /proc/self/fd/1
which points to socket:[12345]
rather than the usual /dev/pts/0
or similar.
So my problem is:
I have something I want to run, via npx concurrently
, but that thing tries to open /dev/stdout. It works on Macos, but fails for users on Linux.
Given that I can’t easily modify the thing that is run, is there another way to around around this issue on Linux?
I have found one workaround, but it comes with some negatives. This is passing the --raw
flag to concurrently
. However as the name implies, it prevents the nice log processing that would otherwise occur.