1103 "method": command, |
1103 "method": command, |
1104 "params": params, |
1104 "params": params, |
1105 } |
1105 } |
1106 cmd = json.dumps(commandDict) + '\n' |
1106 cmd = json.dumps(commandDict) + '\n' |
1107 if self.qsock is not None: |
1107 if self.qsock is not None: |
1108 self.qsock.write(cmd.encode('utf8', 'backslashreplace')) |
1108 self.__writeJsonCommandToSocket(cmd) |
1109 else: |
1109 else: |
1110 self.queue.append(cmd) |
1110 self.queue.append(cmd) |
|
1111 |
|
1112 def __writeJsonCommandToSocket(self, cmd): |
|
1113 """ |
|
1114 Private method to write a JSON command to the socket. |
|
1115 |
|
1116 @param cmd JSON command to be sent |
|
1117 @type str |
|
1118 """ |
|
1119 data = cmd.encode('utf8', 'backslashreplace') |
|
1120 length = "{0:09d}".format(len(data)) |
|
1121 self.qsock.write(length.encode() + data) |
|
1122 self.qsock.flush() |
1111 |
1123 |
1112 |
1124 |
1113 def createDebuggerInterfacePython2(debugServer, passive): |
1125 def createDebuggerInterfacePython2(debugServer, passive): |
1114 """ |
1126 """ |
1115 Module function to create a debugger interface instance. |
1127 Module function to create a debugger interface instance. |