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.

sblom
27.5k4 gold badges74 silver badges96 bronze badges
asked Jul 9, 2012 at 5:04

2 Answers 2

1

flush() stdin, then read() stdout.

Botz3000
39.8k8 gold badges107 silver badges128 bronze badges
answered Jul 9, 2012 at 5:06
Sign up to request clarification or add additional context in comments.

Comments

0

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

answered Jul 9, 2012 at 5:06

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.