After python subprocess.popen return control to user

时间:2017-06-09 12:49:13

标签: python subprocess stdout stdin

I want to send some input (which depends on the programs output) but let the user have interactive control over the program after the input has been sent. I am using

    p = subprocess.Popen(['./program'], stdout=PIPE, stdin=PIPE, stderr=PIPE)

followed by a bunch of conditional p.stdin.write('...') and p.stdout.read(nBytes) statements.

How can I return the control (stdin / stdout) to the user as normal after this is done? I prefer python3 but would also be happy with python2 solutions.

0 个答案:

没有答案