38 "DebugClientCommand": self.__relayDebugClientCommand |
38 "DebugClientCommand": self.__relayDebugClientCommand |
39 } |
39 } |
40 |
40 |
41 self.__mainClientId = None |
41 self.__mainClientId = None |
42 self.__client = None |
42 self.__client = None |
|
43 self.__inStartClient = False |
43 self.__pendingConnections = [] |
44 self.__pendingConnections = [] |
44 self.__connections = {} |
45 self.__connections = {} |
45 |
46 |
46 address = ("127.0.0.1", 0) |
47 address = ("127.0.0.1", 0) |
47 self.__socket = socket.create_server(address, family=socket.AF_INET) |
48 self.__socket = socket.create_server(address, family=socket.AF_INET) |
187 if sock in self.__pendingConnections: |
188 if sock in self.__pendingConnections: |
188 self.__pendingConnections.remove(sock) |
189 self.__pendingConnections.remove(sock) |
189 |
190 |
190 sock.close() |
191 sock.close() |
191 |
192 |
192 if not self.__connections: |
|
193 # no active connections anymore |
|
194 self.__server.sendJson( |
|
195 category=EricRequestCategory.Debugger, |
|
196 reply="LastDebugClientExited", |
|
197 params={}, |
|
198 ) |
|
199 |
|
200 def __mainClientExited(self): |
193 def __mainClientExited(self): |
201 """ |
194 """ |
202 Private method to handle exiting of the main debug client. |
195 Private method to handle exiting of the main debug client. |
203 """ |
196 """ |
204 self.__server.sendJson( |
197 self.__server.sendJson( |
245 |
238 |
246 # reinitialize |
239 # reinitialize |
247 self.__mainClientId = None |
240 self.__mainClientId = None |
248 self.__client = None |
241 self.__client = None |
249 |
242 |
250 # no active connections anymore |
|
251 self.__server.sendJson( |
|
252 category=EricRequestCategory.Debugger, |
|
253 reply="LastDebugClientExited", |
|
254 params={}, |
|
255 ) |
|
256 |
|
257 def __shutdownSocket(self, debuggerId, sock): |
243 def __shutdownSocket(self, debuggerId, sock): |
258 """ |
244 """ |
259 Private method to shut down a socket. |
245 Private method to shut down a socket. |
260 |
246 |
261 @param debuggerId ID of the debugger the socket belongs to |
247 @param debuggerId ID of the debugger the socket belongs to |
300 Private method to start a debug client process. |
286 Private method to start a debug client process. |
301 |
287 |
302 @param params dictionary containing the request data |
288 @param params dictionary containing the request data |
303 @type dict |
289 @type dict |
304 """ |
290 """ |
|
291 self.__inStartClient = True |
|
292 |
305 # 1. stop an already started debug client |
293 # 1. stop an already started debug client |
306 if self.__client is not None: |
294 if self.__client is not None: |
307 self.__client.terminate() |
295 # TODO: unregister stdin & stderr |
308 self.__client = None |
296 pass |
309 |
297 |
310 # 2. start a debug client |
298 # 2. start a debug client |
311 debugClient = os.path.abspath( |
299 debugClient = os.path.abspath( |
312 os.path.join( |
300 os.path.join( |
313 os.path.dirname(__file__), |
301 os.path.dirname(__file__), |
324 |
312 |
325 self.__client = subprocess.Popen( |
313 self.__client = subprocess.Popen( |
326 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE |
314 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE |
327 ) |
315 ) |
328 # TODO: register stdin & stderr with selector |
316 # TODO: register stdin & stderr with selector |
|
317 |
|
318 self.__inStartClient = False |
329 |
319 |
330 def __stopClient(self, params): # noqa: U100 |
320 def __stopClient(self, params): # noqa: U100 |
331 """ |
321 """ |
332 Private method to stop the current debug client process. |
322 Private method to stop the current debug client process. |
333 |
323 |