From b6e70756b88f9014cf9fc518c09baa0937055517 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Mon, 26 Dec 2022 07:00:47 -0800 Subject: Make correction to avoid utf-8ing control sequences --- pkctl.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pkctl.py b/pkctl.py index f54960e..6fa6058 100644 --- a/pkctl.py +++ b/pkctl.py @@ -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 @@ -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() -- cgit v1.2.3