(self, sock)
| 42 | } |
| 43 | |
| 44 | def __init__(self, sock): |
| 45 | if sock == "stdio": |
| 46 | log.info("Connecting to client over stdio...", self) |
| 47 | self.using_stdio = True |
| 48 | stream = messaging.JsonIOStream.from_stdio() |
| 49 | # Make sure that nothing else tries to interfere with the stdio streams |
| 50 | # that are going to be used for DAP communication from now on. |
| 51 | sys.stdin = stdin = open(os.devnull, "r") |
| 52 | atexit.register(stdin.close) |
| 53 | sys.stdout = stdout = open(os.devnull, "w") |
| 54 | atexit.register(stdout.close) |
| 55 | else: |
| 56 | self.using_stdio = False |
| 57 | stream = messaging.JsonIOStream.from_socket(sock) |
| 58 | |
| 59 | with sessions.Session() as session: |
| 60 | super().__init__(session, stream) |
| 61 | |
| 62 | self.client_id = None |
| 63 | """ID of the connecting client. This can be 'test' while running tests.""" |
| 64 | |
| 65 | self.has_started = False |
| 66 | """Whether the "launch" or "attach" request was received from the client, and |
| 67 | fully handled. |
| 68 | """ |
| 69 | |
| 70 | self.start_request = None |
| 71 | """The "launch" or "attach" request as received from the client. |
| 72 | """ |
| 73 | |
| 74 | self.restart_requested = False |
| 75 | """Whether the client requested the debug adapter to be automatically |
| 76 | restarted via "restart":true in the start request. |
| 77 | """ |
| 78 | |
| 79 | self._initialize_request = None |
| 80 | """The "initialize" request as received from the client, to propagate to the |
| 81 | server later.""" |
| 82 | |
| 83 | self._deferred_events = [] |
| 84 | """Deferred events from the launcher and the server that must be propagated |
| 85 | only if and when the "launch" or "attach" response is sent. |
| 86 | """ |
| 87 | |
| 88 | self._forward_terminate_request = False |
| 89 | |
| 90 | self.known_subprocesses = set() |
| 91 | |
| 92 | session.client = self |
| 93 | session.register() |
| 94 | |
| 95 | # For the transition period, send the telemetry events with both old and new |
| 96 | # name. The old one should be removed once the new one lights up. |
| 97 | self.channel.send_event( |
| 98 | "output", |
| 99 | { |
| 100 | "category": "telemetry", |
| 101 | "output": "ptvsd", |
nothing calls this directly
no test coverage detected