[tor-commits] [ooni-probe/master] Properly set exit code when doing oonideckgen

art at torproject.org art at torproject.org
Wed Feb 4 13:27:16 UTC 2015


commit 7116e88e97954b15883fb26cb0e1503b1846e07b
Author: Arturo Filastò <art at fuffa.org>
Date:   Mon Jan 19 12:29:54 2015 +0100

    Properly set exit code when doing oonideckgen
    (patch by Lunar^)
---
 bin/oonideckgen |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bin/oonideckgen b/bin/oonideckgen
index 74ea8de..017a5d8 100755
--- a/bin/oonideckgen
+++ b/bin/oonideckgen
@@ -11,14 +11,23 @@ from twisted.internet import defer, reactor
 from ooni.utils import log
 from ooni.deckgen import cli
 
+exitCode = 128
 def failed(failure):
+    global exitCode
+
     r = failure.trap(exceptions.SystemExit)
     if r != exceptions.SystemExit:
         log.err("Failed to run oonideckgen")
         log.exception(failure)
+        exitCode = 127
+    else:
+        exitCode = failure.value.code
     reactor.stop()
 
 def done(result):
+    global exitCode
+
+    exitCode = 0
     reactor.stop()
 
 def start():
@@ -28,3 +37,4 @@ def start():
 
 reactor.callWhenRunning(start)
 reactor.run()
+sys.exit(exitCode)





More information about the tor-commits mailing list