Not.
If you want to send commands to a subprocess, create a pty, and then remake the subprocess from one end of the pty attached to its STDIN.
Here is a snippet from my code:
RNULL = open('/dev/null', 'r') WNULL = open('/dev/null', 'w') master, slave = pty.openpty() print parsedCmd self.subp = Popen(parsedCmd, shell=False, stdin=RNULL, stdout=WNULL, stderr=slave)
In this code, pty is attached to stderr because it accepts error messages rather than sending commands, but the principle is the same.
Michael dillon
source share