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.