summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2022-12-26 07:00:47 -0800
committerCarson Fleming <cflems@cflems.net>2022-12-26 07:00:47 -0800
commitb6e70756b88f9014cf9fc518c09baa0937055517 (patch)
tree5ac9f25e6acc7c356df6fab0fc4a02e9f085a2e9
parenta7fc7c205f68e5519640b2c60fada27d5cc1761c (diff)
downloadpk-b6e70756b88f9014cf9fc518c09baa0937055517.tar.gz
Make correction to avoid utf-8ing control sequences
-rw-r--r--pkctl.py17
1 files 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()