diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2017-02-10 13:31:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-10 13:31:41 +0100 |
commit | 12db6bbe3712042c10383082a4c40702b800a36a (patch) | |
tree | 45f328c42ce472f17d74d11c1255daf2152a79aa /git/cmd.py | |
parent | b197de0ccc0faf8b4b3da77a46750f39bf7acdb3 (diff) | |
download | gitpython-no_devnull_open.tar.gz |
fix(cmd): checking process.DEVNUL were needlessly opening `os.devnull`no_devnull_open
Fixes resource-leak warning on Windows Puython-3.5.3+:
D:\python-3.5.2.amd64\lib\site-packages\git\cmd.py:583: ResourceWarning:
unclosed file <_io.BufferedWriter name='nul'>
else getattr(subprocess, 'DEVNULL', open(os.devnull, 'wb')))
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -580,7 +580,7 @@ class Git(LazyMixin): stdout_sink = (PIPE if with_stdout - else getattr(subprocess, 'DEVNULL', open(os.devnull, 'wb'))) + else getattr(subprocess, 'DEVNULL', None) or open(os.devnull, 'wb')) log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)", command, cwd, universal_newlines, shell) try: |