src/eric7/RemoteServer/EricServerDebuggerRequestHandler.py

branch
server
changeset 10567
b098e0d028cc
parent 10563
b4b47c1a02ba
child 10574
622e59b51640
equal deleted inserted replaced
10566:25330d3ea3af 10567:b098e0d028cc
113 data = types.SimpleNamespace( 113 data = types.SimpleNamespace(
114 name="debug_client", 114 name="debug_client",
115 address=address, 115 address=address,
116 handler=self.__serviceDbgClientConnection, 116 handler=self.__serviceDbgClientConnection,
117 ) 117 )
118 events = selectors.EVENT_READ 118 self.__server.getSelector().register(connection, selectors.EVENT_READ, data=data)
119 self.__server.getSelector().register(connection, events, data=data)
120 119
121 def __serviceDbgClientConnection(self, key): 120 def __serviceDbgClientConnection(self, key):
122 """ 121 """
123 Private method to service the debug client connection. 122 Private method to service the debug client connection.
124 123
198 category=EricRequestCategory.Debugger, 197 category=EricRequestCategory.Debugger,
199 reply="MainClientExited", 198 reply="MainClientExited",
200 params={"debugger_id": self.__mainClientId if self.__mainClientId else ""}, 199 params={"debugger_id": self.__mainClientId if self.__mainClientId else ""},
201 ) 200 )
202 201
203 def __serviceDbgClientStdoutStderr(self, key):
204 """
205 Private method to service the debug client stdout and stderr channels.
206
207 @param key reference to the SelectorKey object associated with the connection
208 to be serviced
209 @type selectors.SelectorKey
210 """
211 data = key.fileobj.read()
212 if key.data.name == "debug_client_stdout":
213 # TODO: stdout handling not implemented yet
214 print("stdout:", data)
215 elif key.data.name == "debug_client_stderr":
216 # TODO: stderr handling not implemented yet
217 print("stderr:", data)
218
219 def shutdownClients(self): 202 def shutdownClients(self):
220 """ 203 """
221 Public method to shut down all connected clients. 204 Public method to shut down all connected clients.
222 """ 205 """
223 if not self.__client: 206 if not self.__client:
288 @param params dictionary containing the request data 271 @param params dictionary containing the request data
289 @type dict 272 @type dict
290 """ 273 """
291 self.__inStartClient = True 274 self.__inStartClient = True
292 275
293 # 1. stop an already started debug client 276 # start a debug client
294 if self.__client is not None:
295 # TODO: unregister stdin & stderr
296 pass
297
298 # 2. start a debug client
299 debugClient = os.path.abspath( 277 debugClient = os.path.abspath(
300 os.path.join( 278 os.path.join(
301 os.path.dirname(__file__), 279 os.path.dirname(__file__),
302 "..", 280 "..",
303 "DebugClients", 281 "DebugClients",
311 args.extend([str(port), "True", ipaddr]) 289 args.extend([str(port), "True", ipaddr])
312 290
313 self.__client = subprocess.Popen( 291 self.__client = subprocess.Popen(
314 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE 292 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE
315 ) 293 )
316 # TODO: register stdin & stderr with selector
317
318 self.__inStartClient = False
319 294
320 def __stopClient(self, params): # noqa: U100 295 def __stopClient(self, params): # noqa: U100
321 """ 296 """
322 Private method to stop the current debug client process. 297 Private method to stop the current debug client process.
323 298

eric ide

mercurial