Helper to start subprocess and get connected client file.
(self)
| 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.""" |
no test coverage detected