MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _posix_spawn

Method _posix_spawn

tools/python-3.11.9-amd64/Lib/subprocess.py:1752–1789  ·  view source on GitHub ↗

Execute program using os.posix_spawn().

(self, args, executable, env, restore_signals,
                         p2cread, p2cwrite,
                         c2pread, c2pwrite,
                         errread, errwrite)

Source from the content-addressed store, hash-verified

1750
1751
1752 def _posix_spawn(self, args, executable, env, restore_signals,
1753 p2cread, p2cwrite,
1754 c2pread, c2pwrite,
1755 errread, errwrite):
1756 """Execute program using os.posix_spawn()."""
1757 if env is None:
1758 env = os.environ
1759
1760 kwargs = {}
1761 if restore_signals:
1762 # See _Py_RestoreSignals() in Python/pylifecycle.c
1763 sigset = []
1764 for signame in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ'):
1765 signum = getattr(signal, signame, None)
1766 if signum is not None:
1767 sigset.append(signum)
1768 kwargs['setsigdef'] = sigset
1769
1770 file_actions = []
1771 for fd in (p2cwrite, c2pread, errread):
1772 if fd != -1:
1773 file_actions.append((os.POSIX_SPAWN_CLOSE, fd))
1774 for fd, fd2 in (
1775 (p2cread, 0),
1776 (c2pwrite, 1),
1777 (errwrite, 2),
1778 ):
1779 if fd != -1:
1780 file_actions.append((os.POSIX_SPAWN_DUP2, fd, fd2))
1781 if file_actions:
1782 kwargs['file_actions'] = file_actions
1783
1784 self.pid = os.posix_spawn(executable, args, env, **kwargs)
1785 self._child_created = True
1786
1787 self._close_pipe_fds(p2cread, p2cwrite,
1788 c2pread, c2pwrite,
1789 errread, errwrite)
1790
1791 def _execute_child(self, args, executable, preexec_fn, close_fds,
1792 pass_fds, cwd, env,

Callers 1

_execute_childMethod · 0.95

Calls 2

_close_pipe_fdsMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected