I'd like to open a long-running connection with paramiko that requires bi-directional communication. How can I get selectable stdin, stdout and stderr file descriptors? The following:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname="localhost", username="xyz")
stdin, stdout, stderr = ssh.exec_command(cmd)
print "STDIN FILENO", stdin.channel.fileno()
print "STDOUT FILENO", stdout.channel.fileno()
print "STDERR FILENO", stderr.channel.fileno()
... prints "6" for each file descriptor, which turns out to be the stdout of the connection.
But I'd like to do:
r,w,e = select.select( [stdoutfd, stderrfd], [stdinfd] )