From 83645971b8e134f45bded528e0e0786819203252 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Wed, 12 Oct 2016 21:13:20 +0200 Subject: test, #525: allow disabling freeze errors separately + cmd: use DEVNULL for non PIPEs; no open-file. + TCs: some unitestize-assertions on base & remote TCs. --- git/cmd.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'git/cmd.py') 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 -- cgit v1.2.3