[Reproducible-commits] [diffoscope] 16/21: Improve debbuging of command lines and exit codes

Jérémy Bobbio lunar at moszumanska.debian.org
Mon Sep 21 17:39:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository diffoscope.

commit 9e15024c234648f82284ae80983b49653d2a0799
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sun Sep 20 01:02:46 2015 +0200

    Improve debbuging of command lines and exit codes
---
 diffoscope/comparators/utils.py | 5 ++++-
 diffoscope/difference.py        | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/utils.py b/diffoscope/comparators/utils.py
index 1997b00..6364abc 100644
--- a/diffoscope/comparators/utils.py
+++ b/diffoscope/comparators/utils.py
@@ -57,6 +57,7 @@ class Command(object):
 
     def __init__(self, path):
         self._path = path
+        logger.debug('running %s', self.cmdline())
         self._process = subprocess.Popen(self.cmdline(),
                                          shell=False, close_fds=True,
                                          stdin=subprocess.PIPE,
@@ -100,7 +101,9 @@ class Command(object):
         if self._stdin_feeder:
             self._stdin_feeder.join()
         self._stderr_reader.join()
-        return self._process.wait()
+        returncode = self._process.wait()
+        logger.debug('done with %s. exit code %d', self.cmdline()[0], returncode)
+        return returncode
 
     MAX_STDERR_LINES = 50
 
diff --git a/diffoscope/difference.py b/diffoscope/difference.py
index 51d79ac..9266018 100644
--- a/diffoscope/difference.py
+++ b/diffoscope/difference.py
@@ -127,8 +127,8 @@ DIFF_CHUNK = 4096
 
 @tool_required('diff')
 def run_diff(fd1, fd2, end_nl_q1, end_nl_q2):
-    logger.debug('running diff')
     cmd = ['diff', '-au7', '/dev/fd/%d' % fd1, '/dev/fd/%d' % fd2]
+    logger.debug('running %s', cmd)
     def close_fds():
         fds = [int(fd) for fd in os.listdir('/dev/fd')
                        if int(fd) not in (1, 2, fd1, fd2)]
@@ -155,6 +155,7 @@ def run_diff(fd1, fd2, end_nl_q1, end_nl_q2):
     t_read.start()
     t_read.join()
     p.wait()
+    logger.debug('done with diff, returncode %d, parsed %s', p.returncode, parser.success)
     if not parser.success and p.returncode not in (0, 1):
         raise subprocess.CalledProcessError(p.returncode, cmd, output=diff)
     if p.returncode == 0:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list