MCPcopy Index your code
hub / github.com/python/cpython / _connect_and_get_client_file

Method _connect_and_get_client_file

Lib/test/test_remote_pdb.py:1075–1091  ·  view source on GitHub ↗

Helper to start subprocess and get connected client file.

(self)

Source from the content-addressed store, hash-verified

1073 pass
1074
1075 def _connect_and_get_client_file(self):
1076 """Helper to start subprocess and get connected client file."""
1077 # Start the subprocess that will connect to our socket
1078 process = subprocess.Popen(
1079 [sys.executable, self.script_path],
1080 stdout=subprocess.PIPE,
1081 stderr=subprocess.PIPE,
1082 text=True
1083 )
1084
1085 # Accept the connection from the subprocess
1086 client_sock, _ = self.server_sock.accept()
1087 client_file = client_sock.makefile('rwb')
1088 self.addCleanup(client_file.close)
1089 self.addCleanup(client_sock.close)
1090
1091 return process, client_file
1092
1093 def _read_until_prompt(self, client_file):
1094 """Helper to read messages until a prompt is received."""

Calls 3

addCleanupMethod · 0.80
acceptMethod · 0.45
makefileMethod · 0.45

Tested by

no test coverage detected