(self, request)
| 206 | def _start_message_handler(f): |
| 207 | @components.Component.message_handler |
| 208 | def handle(self, request): |
| 209 | assert request.is_request("launch", "attach") |
| 210 | if self._initialize_request is None: |
| 211 | raise request.isnt_valid("Session is not initialized yet") |
| 212 | if self.launcher or self.server: |
| 213 | raise request.isnt_valid("Session is already started") |
| 214 | |
| 215 | self.session.no_debug = request("noDebug", json.default(False)) |
| 216 | if self.session.no_debug: |
| 217 | servers.dont_wait_for_first_connection() |
| 218 | |
| 219 | self.session.debug_options = debug_options = set( |
| 220 | request("debugOptions", json.array(str)) |
| 221 | ) |
| 222 | |
| 223 | f(self, request) |
| 224 | if request.response is not None: |
| 225 | return |
| 226 | |
| 227 | if self.server: |
| 228 | self.server.initialize(self._initialize_request) |
| 229 | self._initialize_request = None |
| 230 | |
| 231 | arguments = request.arguments |
| 232 | if self.launcher: |
| 233 | redirecting = arguments.get("console") == "internalConsole" |
| 234 | if "RedirectOutput" in debug_options: |
| 235 | # The launcher is doing output redirection, so we don't need the |
| 236 | # server to do it, as well. |
| 237 | arguments = dict(arguments) |
| 238 | arguments["debugOptions"] = list( |
| 239 | debug_options - {"RedirectOutput"} |
| 240 | ) |
| 241 | redirecting = True |
| 242 | |
| 243 | if arguments.get("redirectOutput"): |
| 244 | arguments = dict(arguments) |
| 245 | del arguments["redirectOutput"] |
| 246 | redirecting = True |
| 247 | |
| 248 | arguments["isOutputRedirected"] = redirecting |
| 249 | |
| 250 | # pydevd doesn't send "initialized", and responds to the start request |
| 251 | # immediately, without waiting for "configurationDone". If it changes |
| 252 | # to conform to the DAP spec, we'll need to defer waiting for response. |
| 253 | try: |
| 254 | self.server.channel.request(request.command, arguments) |
| 255 | except messaging.NoMoreMessages: |
| 256 | # Server closed connection before we could receive the response to |
| 257 | # "attach" or "launch" - this can happen when debuggee exits shortly |
| 258 | # after starting. It's not an error, but we can't do anything useful |
| 259 | # here at this point, either, so just bail out. |
| 260 | request.respond({}) |
| 261 | self.session.finalize( |
| 262 | "{0} disconnected before responding to {1}".format( |
| 263 | self.server, |
| 264 | json.repr(request.command), |
| 265 | ) |
nothing calls this directly
no test coverage detected