summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLes Aker <me@lesaker.org>2013-09-16 17:19:39 -0400
committerJames Cammarata <jimi@sngx.net>2013-09-19 11:07:43 -0500
commit835bed906a6aad4289e7f349e352b385481e1523 (patch)
tree09109b5871614db9d9c857c45fc184d699ee27b7
parenta5c9d0b18551fa73bff2ace60047c009fcbf07da (diff)
downloadansible-835bed906a6aad4289e7f349e352b385481e1523.tar.gz
fixes for PTY handling
-rw-r--r--lib/ansible/runner/connection_plugins/ssh.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py
index 478f85b3d6..860d4cb8fe 100644
--- a/lib/ansible/runner/connection_plugins/ssh.py
+++ b/lib/ansible/runner/connection_plugins/ssh.py
@@ -26,6 +26,7 @@ import fcntl
import hmac
import pwd
import gettext
+import pty
from hashlib import sha1
import ansible.constants as C
from ansible.callbacks import vvv
@@ -181,11 +182,11 @@ class Connection(object):
try:
# Make sure stdin is a proper (pseudo) pty to avoid: tcgetattr errors
- import pty
master, slave = pty.openpty()
p = subprocess.Popen(ssh_cmd, stdin=slave,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdin = os.fdopen(master, 'w', 0)
+ os.close(slave)
except:
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)