summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorKostis Anagnostopoulos <ankostis@gmail.com>2016-10-12 21:13:20 +0200
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-10-13 02:03:35 +0200
commit83645971b8e134f45bded528e0e0786819203252 (patch)
treeb03d7e77d88c297d52c3ac7280afba65cf1a59e2 /git/cmd.py
parent6310480763cdf01d8816d0c261c0ed7b516d437a (diff)
downloadgitpython-83645971b8e134f45bded528e0e0786819203252.tar.gz
test, #525: allow disabling freeze errors separately
+ cmd: use DEVNULL for non PIPEs; no open-file. + TCs: some unitestize-assertions on base & remote TCs.
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 59f17448..aa711168 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -539,6 +539,9 @@ class Git(LazyMixin):
cmd_not_found_exception = OSError
# end handle
+ stdout_sink = (PIPE
+ if with_stdout
+ else getattr(subprocess, 'DEVNULL', open(os.devnull, 'wb')))
log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)",
command, cwd, universal_newlines, shell)
try:
@@ -548,9 +551,9 @@ class Git(LazyMixin):
bufsize=-1,
stdin=istream,
stderr=PIPE,
- stdout=PIPE if with_stdout else open(os.devnull, 'wb'),
+ stdout=stdout_sink,
shell=shell is not None and shell or self.USE_SHELL,
- close_fds=(is_posix), # unsupported on windows
+ close_fds=is_posix, # unsupported on windows
universal_newlines=universal_newlines,
creationflags=PROC_CREATIONFLAGS,
**subprocess_kwargs