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

Method __init__

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

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)

Source from the content-addressed store, hash-verified

805 _child_created = False # Set here since __del__ checks it
806
807 def __init__(self, args, bufsize=-1, executable=None,
808 stdin=None, stdout=None, stderr=None,
809 preexec_fn=None, close_fds=True,
810 shell=False, cwd=None, env=None, universal_newlines=None,
811 startupinfo=None, creationflags=0,
812 restore_signals=True, start_new_session=False,
813 pass_fds=(), *, user=None, group=None, extra_groups=None,
814 encoding=None, errors=None, text=None, umask=-1, pipesize=-1,
815 process_group=None):
816 """Create new Popen instance."""
817 if not _can_fork_exec:
818 raise OSError(
819 errno.ENOTSUP, f"{sys.platform} does not support processes."
820 )
821
822 _cleanup()
823 # Held while anything is calling waitpid before returncode has been
824 # updated to prevent clobbering returncode if wait() or poll() are
825 # called from multiple threads at once. After acquiring the lock,
826 # code must re-check self.returncode to see if another thread just
827 # finished a waitpid() call.
828 self._waitpid_lock = threading.Lock()
829
830 self._input = None
831 self._communication_started = False
832 if bufsize is None:
833 bufsize = -1 # Restore default
834 if not isinstance(bufsize, int):
835 raise TypeError("bufsize must be an integer")
836
837 if pipesize is None:
838 pipesize = -1 # Restore default
839 if not isinstance(pipesize, int):
840 raise TypeError("pipesize must be an integer")
841
842 if _mswindows:
843 if preexec_fn is not None:
844 raise ValueError("preexec_fn is not supported on Windows "
845 "platforms")
846 else:
847 # POSIX
848 if pass_fds and not close_fds:
849 warnings.warn("pass_fds overriding close_fds.", RuntimeWarning)
850 close_fds = True
851 if startupinfo is not None:
852 raise ValueError("startupinfo is only supported on Windows "
853 "platforms")
854 if creationflags != 0:
855 raise ValueError("creationflags is only supported on Windows "
856 "platforms")
857
858 self.args = args
859 self.stdin = None
860 self.stdout = None
861 self.stderr = None
862 self.pid = None
863 self.returncode = None
864 self.encoding = encoding

Callers

nothing calls this directly

Calls 15

_get_handlesMethod · 0.95
_execute_childMethod · 0.95
SubprocessErrorClass · 0.85
_text_encodingFunction · 0.85
LockMethod · 0.80
DetachMethod · 0.80
CloseMethod · 0.80
_cleanupFunction · 0.70
filterFunction · 0.70
typeClass · 0.50
warnMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected