Skip to content

Commit

Permalink
Make correction to avoid utf-8ing control sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
cflems committed Dec 26, 2022
1 parent a7fc7c2 commit b6e7075
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pkctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,25 @@ def attach_cmd():
reader_thread.start()
while state['attached']:
try:
line = input().strip()
line = bytes(input().strip(), 'utf-8')
except EOFError:
print('detach')
line = 'detach'
if line == 'detach':
line = b'detach'
if line == b'detach':
try:
sock.sendall(b'\xde\xad')
except:
pass
state['attached'] = False
elif line == 'clear':
elif line == b'clear':
os.system('clear')
line = '\xc0\xdeprompt'
line = b'\xc0\xdeprompt'
elif len(line) < 1:
line = '\xc0\xdeprompt'
line = b'\xc0\xdeprompt'
if not state['attached']:
break
try:
sock.sendall(bytes(line, 'utf-8'))
sock.sendall(line)
except:
state['attached'] = False
break
Expand All @@ -111,9 +111,6 @@ def attach_cmd():
reader_thread.join()
return True

def exec_cmd(*args):
pass

def main():
if len(sys.argv) < 2 or sys.argv[1] == 'help':
print_help()
Expand Down

0 comments on commit b6e7075

Please sign in to comment.