mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixes for PTY handling
This commit is contained in:
parent
c934d4a383
commit
98bf473cb2
1 changed files with 2 additions and 1 deletions
|
@ -26,6 +26,7 @@ import fcntl
|
||||||
import hmac
|
import hmac
|
||||||
import pwd
|
import pwd
|
||||||
import gettext
|
import gettext
|
||||||
|
import pty
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
import ansible.constants as C
|
import ansible.constants as C
|
||||||
from ansible.callbacks import vvv
|
from ansible.callbacks import vvv
|
||||||
|
@ -175,11 +176,11 @@ class Connection(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Make sure stdin is a proper (pseudo) pty to avoid: tcgetattr errors
|
# Make sure stdin is a proper (pseudo) pty to avoid: tcgetattr errors
|
||||||
import pty
|
|
||||||
master, slave = pty.openpty()
|
master, slave = pty.openpty()
|
||||||
p = subprocess.Popen(ssh_cmd, stdin=slave,
|
p = subprocess.Popen(ssh_cmd, stdin=slave,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stdin = os.fdopen(master, 'w', 0)
|
stdin = os.fdopen(master, 'w', 0)
|
||||||
|
os.close(slave)
|
||||||
except:
|
except:
|
||||||
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
Loading…
Reference in a new issue