Add process_group argument to subprocess.{run, call, check_call, check_output} (#8125)

This commit is contained in:
Alex Waygood
2022-06-21 15:44:20 +01:00
committed by GitHub
parent 0740d1c48e
commit 67f377898b

View File

@@ -101,7 +101,215 @@ class CompletedProcess(Generic[_T]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 11):
# 3.11 adds "process_group" argument
@overload
def run(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
capture_output: bool = ...,
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: str | None = ...,
text: Literal[True],
timeout: float | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> CompletedProcess[str]: ...
@overload
def run(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
capture_output: bool = ...,
check: bool = ...,
encoding: str,
errors: str | None = ...,
input: str | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> CompletedProcess[str]: ...
@overload
def run(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
capture_output: bool = ...,
check: bool = ...,
encoding: str | None = ...,
errors: str,
input: str | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> CompletedProcess[str]: ...
@overload
def run(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
*,
universal_newlines: Literal[True],
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
# where the *real* keyword only args start
capture_output: bool = ...,
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: str | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> CompletedProcess[str]: ...
@overload
def run(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: Literal[False] = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
capture_output: bool = ...,
check: bool = ...,
encoding: None = ...,
errors: None = ...,
input: bytes | None = ...,
text: Literal[None, False] = ...,
timeout: float | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> CompletedProcess[bytes]: ...
@overload
def run(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
capture_output: bool = ...,
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: _TXT | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> CompletedProcess[Any]: ...
elif sys.version_info >= (3, 10):
# 3.10 adds "pipesize" argument
@overload
def run(
@@ -806,7 +1014,38 @@ else:
) -> CompletedProcess[Any]: ...
# Same args as Popen.__init__
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 11):
# 3.11 adds "process_group" argument
def call(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: float | None = ...,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> int: ...
elif sys.version_info >= (3, 10):
# 3.10 adds "pipesize" argument
def call(
args: _CMD,
@@ -914,7 +1153,38 @@ else:
) -> int: ...
# Same args as Popen.__init__
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 11):
# 3.11 adds "process_group" argument
def check_call(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
timeout: float | None = ...,
*,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> int: ...
elif sys.version_info >= (3, 10):
# 3.10 adds "pipesize" argument
def check_call(
args: _CMD,
@@ -1020,7 +1290,197 @@ else:
timeout: float | None = ...,
) -> int: ...
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 11):
# 3.11 adds "process_group" argument
@overload
def check_output(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: Literal[True],
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> str: ...
@overload
def check_output(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
encoding: str,
errors: str | None = ...,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> str: ...
@overload
def check_output(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
encoding: str | None = ...,
errors: str,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> str: ...
@overload
def check_output(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
*,
universal_newlines: Literal[True],
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
# where the real keyword only ones start
timeout: float | None = ...,
input: _TXT | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> str: ...
@overload
def check_output(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: Literal[False] = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
encoding: None = ...,
errors: None = ...,
text: Literal[None, False] = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> bytes: ...
@overload
def check_output(
args: _CMD,
bufsize: int = ...,
executable: StrOrBytesPath | None = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> Any: ... # morally: -> _TXT
elif sys.version_info >= (3, 10):
# 3.10 adds "pipesize" argument
@overload
def check_output(