2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Do not overwrite 'login' prompt in ssh plugin

ssh plugin was sending backspaces without bound, causing
deletion of the login prompt.
This commit is contained in:
Jarrod Johnson 2016-08-04 16:44:18 -04:00
parent 00da61b981
commit 05e642ada5

View File

@ -117,10 +117,12 @@ class SshShell(conapi.Console):
def write(self, data):
if self.inputmode == 0:
while len(data) > 0 and data[0] == b'\x7f':
while len(data) and data[0] == b'\x7f' and len(self.username):
self.datacallback('\b \b') # erase previously echoed value
self.username = self.username[:-1]
data = data[1:]
while len(data) and data[0] == b'\x7f':
data = data[1:]
while b'\x7f' in data:
delidx = data.index(b'\x7f')
data = data[:delidx - 1] + data[delidx + 1:]