[diffoscope] 03/05: {command, zip, feeders}: replaces .wait by new .returncode property

Mattia Rizzolo mattia at debian.org
Wed Feb 28 21:07:51 CET 2018


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

mattia pushed a commit to branch master
in repository diffoscope.

commit 5d57ecae4051316ea29b7c7e278e0aba59ad743a
Author: Juliana Oliveira <juliana.orod at gmail.com>
Date:   Sat Feb 10 17:26:45 2018 -0200

    {command, zip, feeders}: replaces .wait by new .returncode property
    
    Since wait() now only returns its process returncode, there is no need
    to keep it. This patch adds a returncode property to Command and
    replaces .wait when catching exit codes.
---
 diffoscope/comparators/utils/command.py | 4 ++++
 diffoscope/comparators/zip.py           | 3 ++-
 diffoscope/feeders.py                   | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/utils/command.py b/diffoscope/comparators/utils/command.py
index 0a1634c..a1ae4f9 100644
--- a/diffoscope/comparators/utils/command.py
+++ b/diffoscope/comparators/utils/command.py
@@ -103,5 +103,9 @@ class Command(object, metaclass=abc.ABCMeta):
         return self.stderr
 
     @property
+    def returncode(self):
+        return self._process.returncode
+
+    @property
     def stdout(self):
         return self._process.stdout.splitlines(True)
diff --git a/diffoscope/comparators/zip.py b/diffoscope/comparators/zip.py
index e626138..a3d640c 100644
--- a/diffoscope/comparators/zip.py
+++ b/diffoscope/comparators/zip.py
@@ -120,7 +120,8 @@ class ZipFile(File):
 
 
 class MozillaZipCommandMixin(object):
-    def wait(self):
+    @property
+    def returncode(self):
         # zipinfo emits an error when reading Mozilla-optimized ZIPs,
         # which is fine to ignore.
         return 0
diff --git a/diffoscope/feeders.py b/diffoscope/feeders.py
index f064214..8522584 100644
--- a/diffoscope/feeders.py
+++ b/diffoscope/feeders.py
@@ -86,7 +86,7 @@ def from_command(command):
                 command.filter,
             )
             end_nl = feeder(out_file)
-            returncode = command.wait()
+            returncode = command.returncode
         if returncode not in (0, -signal.SIGTERM):
             raise subprocess.CalledProcessError(
                 returncode,

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


More information about the diffoscope mailing list