# Start the given command. If we don't need to pipeline data, we can try
# to use a pseudo-tty (ssh will have been invoked with -tt). If we are
@ -328,6 +329,12 @@ class Connection(ConnectionBase):
# old pipes.
p=None
ifisinstance(cmd,(text_type,binary_type)):
cmd=to_bytes(cmd)
else:
cmd=map(to_bytes,cmd)
ifnotin_data:
try:
# Make sure stdin is a proper pty to avoid tcgetattr errors
@ -365,7 +372,7 @@ class Connection(ConnectionBase):
# only when using ssh. Otherwise we can send initial data straightaway.
state=states.index('ready_to_send')
if'ssh'incmd:
ifb'ssh'incmd:
ifself._play_context.prompt:
# We're requesting escalation with a password, so we have to
# wait for a password prompt.
@ -538,7 +545,7 @@ class Connection(ConnectionBase):
stdin.close()
ifC.HOST_KEY_CHECKING:
ifcmd[0]=="sshpass"andp.returncode==6:
ifcmd[0]==b"sshpass"andp.returncode==6:
raiseAnsibleError('Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host\'s fingerprint to your known_hosts file to manage this host.')