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

Method notify_of_subprocess

src/debugpy/adapter/clients.py:732–778  ·  view source on GitHub ↗
(self, conn)

Source from the content-addressed store, hash-verified

730 )
731
732 def notify_of_subprocess(self, conn):
733 log.info("{1} is a subprocess of {0}.", self, conn)
734 with self.session:
735 if self.start_request is None or conn in self.known_subprocesses:
736 return
737 if "processId" in self.start_request.arguments:
738 log.warning(
739 "Not reporting subprocess for {0}, because the parent process "
740 'was attached to using "processId" rather than "port".',
741 self.session,
742 )
743 return
744
745 log.info("Notifying {0} about {1}.", self, conn)
746 body = dict(self.start_request.arguments)
747 self.known_subprocesses.add(conn)
748 self.session.notify_changed()
749
750 for key in "processId", "listen", "preLaunchTask", "postDebugTask", "request", "restart":
751 body.pop(key, None)
752
753 body["name"] = "Subprocess {0}".format(conn.pid)
754 body["subProcessId"] = conn.pid
755
756 for key in "args", "processName", "pythonArgs":
757 body.pop(key, None)
758
759 host = body.pop("host", None)
760 port = body.pop("port", None)
761 if "connect" not in body:
762 body["connect"] = {}
763 if "host" not in body["connect"]:
764 localhost = sockets.get_default_localhost()
765 body["connect"]["host"] = host or localhost
766 if "port" not in body["connect"]:
767 if port is None:
768 _, port = sockets.get_address(listener)
769 body["connect"]["port"] = port
770
771 if self.capabilities["supportsStartDebuggingRequest"]:
772 self.channel.request("startDebugging", {
773 "request": "attach",
774 "configuration": body,
775 })
776 else:
777 body["request"] = "attach"
778 self.channel.send_event("debugpyAttach", body)
779
780
781def serve(host, port):

Callers 2

__init__Method · 0.80

Calls 7

infoMethod · 0.80
notify_changedMethod · 0.80
popMethod · 0.80
get_addressMethod · 0.80
send_eventMethod · 0.80
addMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected