added status code check

In the existing implementation when the ssh command fails the command
result is silently discarded. It hides the fact that the disconnection
did not go as expected. Effectively the intended action was not
successful, but the play continues.
pull/25211/head
Piotr Smolinski 8 years ago
parent db08ff6dbd
commit fe2eb2ae4a

@ -897,6 +897,8 @@ class Connection(ConnectionBase):
display.vvv(u'sending stop: %s' % cmd)
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
status_code = p.wait()
if status_code != 0:
self.close()

Loading…
Cancel
Save