(read_fd, write_fd)
| 230 | pid = None |
| 231 | |
| 232 | def fork_thread(read_fd, write_fd): |
| 233 | nonlocal pid |
| 234 | |
| 235 | # fork in a thread |
| 236 | pid = os.fork() |
| 237 | if pid: |
| 238 | # parent process |
| 239 | return |
| 240 | |
| 241 | # child process |
| 242 | try: |
| 243 | os.close(read_fd) |
| 244 | os.write(write_fd, b"OK") |
| 245 | finally: |
| 246 | os._exit(0) |
| 247 | |
| 248 | with threading_helper.wait_threads_exit(): |
| 249 | thread.start_new_thread(fork_thread, (self.read_fd, self.write_fd)) |