I am executing certain commands and would like to capture the output of the same.
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip,username="username",password="pwd")
stdin, stdout, stderr = ssh.exec_command("whoami")
out = stdout.read()
print out # prints username
print stdout.read() # prints nothing, why is it so ?
# Instance #1
stdin, stdout, stderr = ssh.exec_command("kill -9 1111")
out = stdout.read()
print out #prints nothing. expected as it doesn't capture if it's successful
# print out # should print "-bash: kill: (1111) - No such process" , if it doesn't exist
#--> Instance #2
In Instance #1, why print stdout.read() , prints nothing ?
In Instance #2, How to capture such outputs/response ?