1

I need to transform a CLI into a "spawn" syntax in nodejs, and I got into a little mess, couldn't figure out from the docs what to do with it.

the syntax is something like this:

 somecommand -a op1 -b op2 | othercommand -c op1 -d op2

The "othercommand" should get "live" output from "somecommand". and I want to monitor "othercommand"'s output.

Thanks, Tal.

1

1 Answer 1

2

In your somecommand.js, write your output to process.stdout, in othercommand.js, pipe process.stdin to a stream such as though, doing your work with the stream, then pipe the stream to process.stdout

Sign up to request clarification or add additional context in comments.

1 Comment

I don't deal with javascript, i deal with BASH commands. kinda like ps aux | grep 'something'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.