(self)
| 167 | 'relaunching. Some resources might leak.') |
| 168 | |
| 169 | def _launch(self): |
| 170 | fds_to_pass = [] |
| 171 | try: |
| 172 | fds_to_pass.append(sys.stderr.fileno()) |
| 173 | except Exception: |
| 174 | pass |
| 175 | r, w = os.pipe() |
| 176 | try: |
| 177 | fds_to_pass.append(r) |
| 178 | # process will out live us, so no need to wait on pid |
| 179 | exe = spawn.get_executable() |
| 180 | args = [ |
| 181 | exe, |
| 182 | *util._args_from_interpreter_flags(), |
| 183 | '-c', |
| 184 | f'from multiprocessing.resource_tracker import main;main({r})', |
| 185 | ] |
| 186 | # bpo-33613: Register a signal mask that will block the signals. |
| 187 | # This signal mask will be inherited by the child that is going |
| 188 | # to be spawned and will protect the child from a race condition |
| 189 | # that can make the child die before it registers signal handlers |
| 190 | # for SIGINT and SIGTERM. The mask is unregistered after spawning |
| 191 | # the child. |
| 192 | prev_sigmask = None |
| 193 | try: |
| 194 | if _HAVE_SIGMASK: |
| 195 | prev_sigmask = signal.pthread_sigmask(signal.SIG_BLOCK, _IGNORED_SIGNALS) |
| 196 | pid = util.spawnv_passfds(exe, args, fds_to_pass) |
| 197 | finally: |
| 198 | if prev_sigmask is not None: |
| 199 | signal.pthread_sigmask(signal.SIG_SETMASK, prev_sigmask) |
| 200 | except: |
| 201 | os.close(w) |
| 202 | raise |
| 203 | else: |
| 204 | self._fd = w |
| 205 | self._pid = pid |
| 206 | finally: |
| 207 | os.close(r) |
| 208 | |
| 209 | def _make_probe_message(self): |
| 210 | """Return a probe message.""" |
no test coverage detected