channel.recv_exit_status in paramiko always returns the return code of the first command executed over invoke_shell
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
paramiko |
New
|
Undecided
|
Unassigned |
Bug Description
I am getting some discrepancy in the return code below. May be I am not using in the proper way. Every-time I print the return code, it prints the same as the first one has returned. Do I need to reset the return code. I mean in the following example, I am getting the return code as 2 for both the commands. Now when I interchange both the commands, I mean replace ls -al;exit\n with ls -al file_not_
ssh = paramiko.
ssh.set_
ssh.connect(
channel = ssh.invoke_shell()
channel.send('ls -al file_not_
time.sleep(3)
print "My 1st command exit status is: ",channel.
print "My 1st command return code is: ", channel.
channel.send('ls -al;exit\n')
time.sleep(3)
print "My 2nd command exit status is: ",channel.
print "My 2nd command return code is: ",channel.
This should print the return code of each command. Please let me know if I am doing wrong somewhere.