Commit 08aa87f5 authored by Igor Mammedov's avatar Igor Mammedov Committed by Eduardo Habkost
Browse files

qmp: make qmp-shell work with python3



python3 doesn't have raw_input(), so qmp-shell breaks.
Use input() instead and override it with raw_input()
if running on python2.

Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
Message-Id: <20190620154035.30989-1-imammedo@redhat.com>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent 7d0e0240
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ import re
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu import qmp

if sys.version_info[0] == 2:
    input = raw_input

class QMPCompleter(list):
    def complete(self, text, state):
        for cmd in self:
@@ -308,7 +311,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
        @return True if execution was ok, return False if disconnected.
        """
        try:
            cmdline = raw_input(prompt)
            cmdline = input(prompt)
        except EOFError:
            print()
            return False