[diffoscope] 01/06: Emit json on the the status file descriptor so we can easily add more fields.

Chris Lamb chris at chris-lamb.co.uk
Wed Dec 28 19:40:01 CET 2016


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

lamby pushed a commit to branch master
in repository diffoscope.

commit 20ffff6a47ff2df2b623c4953ddfc9eb7e489771
Author: Chris Lamb <lamby at debian.org>
Date:   Wed Dec 28 17:02:20 2016 +0000

    Emit json on the the status file descriptor so we can easily add more fields.
---
 diffoscope/progress.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/diffoscope/progress.py b/diffoscope/progress.py
index 08c8e05..5cce25a 100644
--- a/diffoscope/progress.py
+++ b/diffoscope/progress.py
@@ -19,6 +19,7 @@
 
 import os
 import sys
+import json
 
 class ProgressManager(object):
     _singleton = {}
@@ -135,7 +136,10 @@ class StatusFD(object):
         self.fileobj = os.fdopen(fileno, 'w')
 
     def notify(self, current, total, msg):
-        print('{}\t{}'.format(current, total), file=self.fileobj)
+        print(json.dumps({
+            'total': total,
+            'current': current,
+        }), file=self.fileobj)
 
     def finish(self):
         pass

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


More information about the diffoscope mailing list