summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-19 14:42:58 +0000
committerGerrit Code Review <review@openstack.org>2019-03-19 14:42:58 +0000
commit7e3f18bc04a1518e16507a077b40605745fc6abc (patch)
treea9842d912aa415071ed24b4dfe7ce75be8422c64
parent70f3bf113eed1502c83431744f359390fd7c37c7 (diff)
parent2f9eebc2110aa76648ae8bb11c757d6196d490a2 (diff)
Merge "Fix python3 encoding issues for remote commands"
-rw-r--r--gertty/app.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gertty/app.py b/gertty/app.py
index 2c14e66..a6060cc 100644
--- a/gertty/app.py
+++ b/gertty/app.py
@@ -374,12 +374,12 @@ class App(object):
374 try: 374 try:
375 s, addr = self.socket.accept() 375 s, addr = self.socket.accept()
376 self.log.debug("Accepted socket connection %s" % (s,)) 376 self.log.debug("Accepted socket connection %s" % (s,))
377 buf = '' 377 buf = b''
378 while True: 378 while True:
379 buf += s.recv(1) 379 buf += s.recv(1)
380 if buf[-1] == '\n': 380 if buf[-1] == 10:
381 break 381 break
382 buf = buf.strip() 382 buf = buf.decode('utf8').strip()
383 self.log.debug("Received %s from socket" % (buf,)) 383 self.log.debug("Received %s from socket" % (buf,))
384 s.close() 384 s.close()
385 parts = buf.split() 385 parts = buf.split()
@@ -874,7 +874,7 @@ class OpenChangeAction(argparse.Action):
874 874
875 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) 875 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
876 s.connect(cf.socket_path) 876 s.connect(cf.socket_path)
877 s.sendall('open %s\n' % url) 877 s.sendall(('open %s\n' % url).encode('utf8'))
878 sys.exit(0) 878 sys.exit(0)
879 879
880def main(): 880def main():