Skip to content

Commit 78d63d9

Browse files
committed
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.
1 parent 96acc22 commit 78d63d9

File tree

2 files changed

+0
-2
lines changed

2 files changed

+0
-2
lines changed

git/cmd.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,6 @@ def execute(
10011001
stderr=PIPE,
10021002
stdout=stdout_sink,
10031003
shell=shell,
1004-
close_fds=(os.name == "posix"), # Unsupported on Windows.
10051004
universal_newlines=universal_newlines,
10061005
creationflags=PROC_CREATIONFLAGS,
10071006
**subprocess_kwargs,

git/index/fun.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None:
102102
stdout=subprocess.PIPE,
103103
stderr=subprocess.PIPE,
104104
cwd=index.repo.working_dir,
105-
close_fds=(os.name == "posix"),
106105
creationflags=PROC_CREATIONFLAGS,
107106
)
108107
except Exception as ex:

0 commit comments

Comments
 (0)
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