[Reproducible-commits] [debbindiff] 02/02: Fix some file descriptor leaks
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Apr 3 18:54:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository debbindiff.
commit 14d274d8fac621b1b6d64221e1c40ff80c92d99e
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Apr 3 20:54:04 2015 +0200
Fix some file descriptor leaks
---
debbindiff/comparators/binary.py | 5 ++++-
debbindiff/difference.py | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/debbindiff/comparators/binary.py b/debbindiff/comparators/binary.py
index 5d1fb05..682ebb5 100644
--- a/debbindiff/comparators/binary.py
+++ b/debbindiff/comparators/binary.py
@@ -27,8 +27,11 @@ from debbindiff import tool_required, RequiredToolNotFound
@contextmanager
@tool_required('xxd')
def xxd(path):
- p = subprocess.Popen(['xxd', path], shell=False, stdout=subprocess.PIPE)
+ p = subprocess.Popen(['xxd', path], shell=False, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, close_fds=True)
yield p.stdout
+ p.stdout.close()
+ p.stderr.close()
if p.poll() is None:
p.terminate()
p.wait()
diff --git a/debbindiff/difference.py b/debbindiff/difference.py
index e42d955..06ab962 100644
--- a/debbindiff/difference.py
+++ b/debbindiff/difference.py
@@ -154,6 +154,8 @@ def run_diff(fd1, fd2, end_nl_q1, end_nl_q2):
stderr=subprocess.STDOUT,
preexec_fn=close_fds)
p.stdin.close()
+ os.close(fd1)
+ os.close(fd2)
parser = DiffParser(p.stdout, end_nl_q1, end_nl_q2)
t_read = Thread(target=parser.parse)
t_read.daemon = True
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git
More information about the Reproducible-commits
mailing list