diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-05-24 17:52:55 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2016-05-24 17:52:55 +0200 |
commit | 7228ca9bf651d9f06395419752139817511aabe1 (patch) | |
tree | ab53d6187ded8885e4f1e03390cd7e9711958419 | |
parent | 7a8f96cc8a5135a0ece19e600da914dabca7d215 (diff) | |
download | gitpython-7228ca9bf651d9f06395419752139817511aabe1.tar.gz |
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
-rw-r--r-- | doc/source/changes.rst | 2 | ||||
-rw-r--r-- | git/cmd.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 8cc9ca0d..b14df90a 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -7,6 +7,8 @@ Changelog * Fix: progress handler exceptions are not caught anymore, which would usually just hide bugs previously. +* Fix: The `Git.execute` method will now redirect `stdout` to `devnull` if `with_stdout` is false, + which is the intended behaviour based on the parameter's documentation. 2.0.2 - Fixes ============= @@ -605,7 +605,7 @@ class Git(LazyMixin): bufsize=-1, stdin=istream, stderr=PIPE, - stdout=with_stdout and PIPE or None, + stdout=with_stdout and PIPE or open(os.devnull, 'wb'), shell=self.USE_SHELL, close_fds=(os.name == 'posix'), # unsupported on windows **subprocess_kwargs |