[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] change again command report structure for ProcessTest



commit e5a532658904a06e9167d89a9291896cc3c1b620
Author: juga0 <juga>
Date:   Thu Dec 24 13:28:38 2015 +0000

    change again command report structure for ProcessTest
    
    * Change report structure as commented in https://github.com/TheTorProject/ooni-probe/pull/445#issuecomment-166981539
---
 ooni/templates/process.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ooni/templates/process.py b/ooni/templates/process.py
index b7dafdd..82457dc 100644
--- a/ooni/templates/process.py
+++ b/ooni/templates/process.py
@@ -103,10 +103,14 @@ class ProcessTest(NetTestCase):
 
     def processEnded(self, result, command):
         log.debug("Finished %s: %s" % (command, result))
-        self.report['command_name'] = ' '.join(command)
-        self.report['command_stdout'] = result['stdout']
-        self.report['command_stderr'] = result['stderr']
-        self.report['command_exit_reason'] = result['exit_reason']
+        if not isinstance(self.report.get('commands'), list):
+            self.report['commands'] = []
+        self.report['commands'].append({
+            'command_name': ' '.join(command),
+            'command_stdout': result['stdout'],
+            'command_stderr': result['stderr'],
+            'command_exit_reason': result['exit_reason'],
+        })
         return result
 
     def run(self, command, finished=None, env={}, path=None, usePTY=0):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits