MCPcopy Create free account
hub / github.com/microsoft/debugpy / _process_request

Method _process_request

tests/debug/session.py:646–676  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

644 return [cls._shell_unquote(a) for a in args]
645
646 def _process_request(self, request):
647 self.timeline.record_request(request, block=False)
648 if request.command == "runInTerminal":
649 args = request("args", json.array(str, vectorize=True))
650 args_can_be_interpreted_by_shell = request("argsCanBeInterpretedByShell", False)
651 if len(args) > 0 and args_can_be_interpreted_by_shell:
652 # The final arg is a string that contains multiple actual arguments.
653 # Split it like a shell would, but keep the rest of the args (including
654 # any quoting) intact so tests can inspect the raw runInTerminal argv.
655 last_arg = args.pop()
656 args += self._split_shell_arg_string(last_arg)
657 cwd = request("cwd", ".")
658 env = request("env", json.object(str))
659 try:
660 self._run_in_terminal_args_can_be_interpreted_by_shell = (
661 args_can_be_interpreted_by_shell
662 )
663 return self.run_in_terminal(args, cwd, env)
664 except Exception as exc:
665 log.swallow_exception('"runInTerminal" failed:')
666 raise request.cant_handle(str(exc))
667 finally:
668 self._run_in_terminal_args_can_be_interpreted_by_shell = False
669
670 elif request.command == "startDebugging":
671 pid = request("configuration", dict)("subProcessId", int)
672 watchdog.register_spawn(pid, f"{self.debuggee_id}-subprocess-{pid}")
673 return {}
674
675 else:
676 raise request.isnt_valid("not supported")
677
678 def _process_response(self, request, response):
679 self.timeline.record_response(request, response, block=False)

Callers

nothing calls this directly

Calls 6

run_in_terminalMethod · 0.95
record_requestMethod · 0.80
popMethod · 0.80
cant_handleMethod · 0.80
isnt_validMethod · 0.80

Tested by

no test coverage detected