2

How can I read from output PIPE multiple times without using process.communicate() as communicate closes the PIPE after reading the output but I need to have sequential inputs and outputs.

For example,

1) process.stdin.write('input_1')

2) After that, I need to read the output PIPE (how can I accomplish that without using communicate as it closes the PIPE) and then give another input as

3) process.stdin.write('input_2')

4) And then read the output of step 3

But if I use process.communicate after giving first input then it closes the output PIPE and i am unable to give second input as the PIPE is closed.

Kindly help please.

2 Answers 2

1

flush() stdin, then read() stdout.

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

Comments

0

Instead of process.communicate(), use process.stdout.read()

Comments

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.