From 82b33c381f110e3bfa82dd589ad6c06fbd6be374 Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Thu, 24 Sep 2015 19:57:49 +0530 Subject: [PATCH] We don't need even a token timeout here; just poll once The process is already gone, so there's not going to be any new data showing up on its stderr; we only want to make sure that we haven't missed something that was already written. So polling once is enough. --- lib/ansible/plugins/connection/ssh.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index d1901485f02..801df55a014 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -542,11 +542,13 @@ class Connection(ConnectionBase): # When ssh has ControlMaster (+ControlPath/Persist) enabled, the # first connection goes into the background and we never see EOF # on stderr. If we see EOF on stdout and the process has exited, - # we're done. Just to be extra sure that we aren't missing any - # output on stderr, we call select again with a small timeout. + # we're probably done. We call select again with a zero timeout, + # just to make certain we don't miss anything that may have been + # written to stderr between the time we called select() and when + # we learned that the process had finished. if not p.stdout in rpipes: - timeout = 0.001 + timeout = 0 continue # If the process has not yet exited, but we've already read EOF from