46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
|
From e025b9c0fe78621f1c6f9f7655c142a8a3d516fe Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cedric.bosdonnat@free.fr>
|
||
|
Date: Wed, 13 Dec 2017 11:35:39 +0100
|
||
|
Subject: [PATCH] python3: fix bytes/string mess in serial console
|
||
|
|
||
|
Add a few encode() and decode() to convert between libvirt stream
|
||
|
functions expecting bytes arrays and Vte callbacks providing strings.
|
||
|
---
|
||
|
virtManager/serialcon.py | 6 +++---
|
||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/virtManager/serialcon.py b/virtManager/serialcon.py
|
||
|
index 7caf6db4..21ab8ae7 100644
|
||
|
--- a/virtManager/serialcon.py
|
||
|
+++ b/virtManager/serialcon.py
|
||
|
@@ -149,7 +149,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
|
||
|
|
||
|
self.stream = None
|
||
|
|
||
|
- self.streamToTerminal = ""
|
||
|
+ self.streamToTerminal = b""
|
||
|
self.terminalToStream = ""
|
||
|
|
||
|
def _event_on_stream(self, stream, events, opaque):
|
||
|
@@ -187,7 +187,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
|
||
|
self.terminalToStream):
|
||
|
|
||
|
try:
|
||
|
- done = self.stream.send(self.terminalToStream)
|
||
|
+ done = self.stream.send(self.terminalToStream.encode())
|
||
|
except Exception:
|
||
|
logging.exception("Error sending stream data")
|
||
|
self.close()
|
||
|
@@ -262,7 +262,7 @@ class LibvirtConsoleConnection(ConsoleConnection):
|
||
|
return
|
||
|
|
||
|
terminal.feed(self.streamToTerminal)
|
||
|
- self.streamToTerminal = ""
|
||
|
+ self.streamToTerminal = b""
|
||
|
|
||
|
|
||
|
class vmmSerialConsole(vmmGObject):
|
||
|
--
|
||
|
2.15.1
|
||
|
|