1

I need to communicate with a background process via a named pipe. This background process is a node.js process.

So I do this in a shell script:

mkfifo MYPIPE
node script.js < MYPIPE

what happens is that the node.js script does not start - it appears to be waiting for the first stdin message to be written to MYPIPE.

What I want to do, is send the data from MYPIPE to the stdin of the node process, but I want to start the node.js process instead of it waiting for the first message from MYPIPE. How do I do that?

0

this was just a simple case of doing this instead:

cat MYPIPE | node script.js

I guess I just don't understand why that behaves differently than

node script.js < MYPIPE
  • and maybe I need to add an option to cat, so that it continues to read from the named pipe. – Alexander Mills Jul 7 '17 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.