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.
This commit is contained in:
Piotr Smolinski 2017-05-31 14:28:08 +02:00
parent db08ff6dbd
commit fe2eb2ae4a

View file

@ -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()