[diffoscope] 03/04: progress: Rewrite StatusFD to take a file object, not a file descriptor.

Chris Lamb chris at chris-lamb.co.uk
Sun Feb 5 03:44:58 CET 2017


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

lamby pushed a commit to branch master
in repository diffoscope.

commit 6e71604d48c890bebce602b1f286659261d82777
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Feb 5 15:40:54 2017 +1300

    progress: Rewrite StatusFD to take a file object, not a file descriptor.
    
    This is to help testing (see next commit)
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/progress.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/diffoscope/progress.py b/diffoscope/progress.py
index 1b2751f..220ac96 100644
--- a/diffoscope/progress.py
+++ b/diffoscope/progress.py
@@ -52,7 +52,7 @@ class ProgressManager(object):
                     raise
 
         if parsed_args.status_fd:
-            self.register(StatusFD(parsed_args.status_fd))
+            self.register(StatusFD(os.fdopen(parsed_args.status_fd, 'w')))
 
     ##
 
@@ -143,8 +143,8 @@ class ProgressBar(object):
         self.bar.finish()
 
 class StatusFD(object):
-    def __init__(self, fileno):
-        self.fileobj = os.fdopen(fileno, 'w')
+    def __init__(self, fileobj):
+        self.fileobj = fileobj
 
     def notify(self, current, total, msg):
         print(json.dumps({

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


More information about the diffoscope mailing list