Skip to content

Commit

Permalink
Merge pull request ansible#5879 from lberruti/ssh_slow_fix
Browse files Browse the repository at this point in the history
Fix slow ssh
  • Loading branch information
jctanner committed Feb 5, 2014
2 parents 1f9de0c + 75b7a1d commit 0a0e981
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ansible/runner/connection_plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ def exec_command(self, cmd, tmp_path, sudo_user=None, sudoable=False, executable
# Calling wait while there are still pipes to read can cause a lock
elif not rpipes and p.poll() == None:
p.wait()
# the process has finished and the pipes are empty,
# if we loop and do the select it waits all the timeout
break
stdin.close() # close stdin after we read from stdout (see also issue #848)

if C.HOST_KEY_CHECKING and not_in_host_file:
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/runner/connection_plugins/ssh_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def exec_command(self, cmd, tmp_path, sudo_user=None, sudoable=False, executable
# Calling wait while there are still pipes to read can cause a lock
elif not rpipes and p.poll() == None:
p.wait()
# the process has finished and the pipes are empty,
# if we loop and do the select it waits all the timeout
break
stdin.close() # close stdin after we read from stdout (see also issue #848)

if C.HOST_KEY_CHECKING and not_in_host_file:
Expand Down

0 comments on commit 0a0e981

Please sign in to comment.