Skip to content

Commit 7228ca9

Browse files
committed
fix(cmd): fix with_stdout implementation
Admittedly this fix is solely based on the documentation provided for this parameter, which indicated a different intend than was actually implemented. Also I don't believe doing this will cause any harm. As a special note: the call to `open(os.devnull, 'wb')` does not seem leak the handle, apparently it is given as-is to the subprocess, which will then close it naturally. This was tested using an interactive session via `htop` on osx. Fixes #437
1 parent 7a8f96c commit 7228ca9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/source/changes.rst

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Changelog
77

88
* Fix: progress handler exceptions are not caught anymore, which would usually just hide bugs
99
previously.
10+
* Fix: The `Git.execute` method will now redirect `stdout` to `devnull` if `with_stdout` is false,
11+
which is the intended behaviour based on the parameter's documentation.
1012

1113
2.0.2 - Fixes
1214
=============

git/cmd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def execute(self, command,
605605
bufsize=-1,
606606
stdin=istream,
607607
stderr=PIPE,
608-
stdout=with_stdout and PIPE or None,
608+
stdout=with_stdout and PIPE or open(os.devnull, 'wb'),
609609
shell=self.USE_SHELL,
610610
close_fds=(os.name == 'posix'), # unsupported on windows
611611
**subprocess_kwargs

0 commit comments

Comments
 (0)