From 78d63d9ecf4cfbeea34dbc464890b97137f3be1b Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 1 Dec 2023 02:53:51 -0500 Subject: [PATCH] Let close_fds be True on all platforms Since Python 3.7, subprocess.Popen supports close_fds=True on all platforms, including Windows, and it is the default, including when arguments for standard streams have non-None values passed. 3.7 is the lowest version of Python that GitPython supports. So this omits the close_fds=True argument from the calls where it was present. This has the same effect (in 3.7 and higher) as passing close_fds=True. When the the close_fd argument was added to the Popen call in git.cmd.Git.execute in 1ee2afb, Python 2 was still supported. In Python 2, close_fds defaulted to False. This appears to be the reason it had been passed explicitly. It was conditioned on being on a Unix-like system because having it True on Windows would prevent stdin, stdout, or stderr redirection. --- git/cmd.py | 1 - git/index/fun.py | 1 - 2 files changed, 2 deletions(-) diff --git a/git/cmd.py b/git/cmd.py index cde6073da..05e199dc0 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -1001,7 +1001,6 @@ def execute( stderr=PIPE, stdout=stdout_sink, shell=shell, - close_fds=(os.name == "posix"), # Unsupported on Windows. universal_newlines=universal_newlines, creationflags=PROC_CREATIONFLAGS, **subprocess_kwargs, diff --git a/git/index/fun.py b/git/index/fun.py index 7b3b06269..eaf5f51ff 100644 --- a/git/index/fun.py +++ b/git/index/fun.py @@ -102,7 +102,6 @@ def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None: stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=index.repo.working_dir, - close_fds=(os.name == "posix"), creationflags=PROC_CREATIONFLAGS, ) except Exception as ex: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy