Create new Popen instance.
(self, args, bufsize=-1, executable=None,
stdin=None, stdout=None, stderr=None,
preexec_fn=None, close_fds=True,
shell=False, cwd=None, env=None, universal_newlines=None,
startupinfo=None, creationflags=0,
restore_signals=True, start_new_session=False,
pass_fds=(), *, user=None, group=None, extra_groups=None,
encoding=None, errors=None, text=None, umask=-1, pipesize=-1,
process_group=None)
| 868 | _child_created = False # Set here since __del__ checks it |
| 869 | |
| 870 | def __init__(self, args, bufsize=-1, executable=None, |
| 871 | stdin=None, stdout=None, stderr=None, |
| 872 | preexec_fn=None, close_fds=True, |
| 873 | shell=False, cwd=None, env=None, universal_newlines=None, |
| 874 | startupinfo=None, creationflags=0, |
| 875 | restore_signals=True, start_new_session=False, |
| 876 | pass_fds=(), *, user=None, group=None, extra_groups=None, |
| 877 | encoding=None, errors=None, text=None, umask=-1, pipesize=-1, |
| 878 | process_group=None): |
| 879 | """Create new Popen instance.""" |
| 880 | if not _can_fork_exec: |
| 881 | raise OSError( |
| 882 | errno.ENOTSUP, f"{sys.platform} does not support processes." |
| 883 | ) |
| 884 | |
| 885 | _cleanup() |
| 886 | # Held while anything is calling waitpid before returncode has been |
| 887 | # updated to prevent clobbering returncode if wait() or poll() are |
| 888 | # called from multiple threads at once. After acquiring the lock, |
| 889 | # code must re-check self.returncode to see if another thread just |
| 890 | # finished a waitpid() call. |
| 891 | self._waitpid_lock = threading.Lock() |
| 892 | |
| 893 | self._input = None |
| 894 | self._communication_started = False |
| 895 | if bufsize is None: |
| 896 | bufsize = -1 # Restore default |
| 897 | if not isinstance(bufsize, int): |
| 898 | raise TypeError("bufsize must be an integer") |
| 899 | |
| 900 | if stdout is STDOUT: |
| 901 | raise ValueError("STDOUT can only be used for stderr") |
| 902 | |
| 903 | if pipesize is None: |
| 904 | pipesize = -1 # Restore default |
| 905 | if not isinstance(pipesize, int): |
| 906 | raise TypeError("pipesize must be an integer") |
| 907 | |
| 908 | if _mswindows: |
| 909 | if preexec_fn is not None: |
| 910 | raise ValueError("preexec_fn is not supported on Windows " |
| 911 | "platforms") |
| 912 | else: |
| 913 | # POSIX |
| 914 | if pass_fds and not close_fds: |
| 915 | warnings.warn("pass_fds overriding close_fds.", RuntimeWarning) |
| 916 | close_fds = True |
| 917 | if startupinfo is not None: |
| 918 | raise ValueError("startupinfo is only supported on Windows " |
| 919 | "platforms") |
| 920 | if creationflags != 0: |
| 921 | raise ValueError("creationflags is only supported on Windows " |
| 922 | "platforms") |
| 923 | |
| 924 | self.args = args |
| 925 | self.stdin = None |
| 926 | self.stdout = None |
| 927 | self.stderr = None |
nothing calls this directly
no test coverage detected