[tor-commits] [chutney/master] Make chutney exit with -1 on failure.

nickm at torproject.org nickm at torproject.org
Mon Jun 24 17:08:21 UTC 2013


commit 19abaf8052e8a561536ec102f1c4f624d2494de6
Author: Linus Nordberg <linus at torproject.org>
Date:   Wed Jun 5 15:48:57 2013 +0200

    Make chutney exit with -1 on failure.
    
    If the function implementing the command (the verb, in argv[1]) return
    False, exit with -1. Else exit with 0 as before.
---
 lib/chutney/TorNet.py |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 3ec33b6..e79f0a8 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -673,7 +673,7 @@ def runConfigFile(verb, f):
         print "Error: I don't know how to %s." % verb
         return
 
-    getattr(network,verb)()
+    return getattr(network,verb)()
 
 def main():
     global _BASE_ENVIRON
@@ -687,7 +687,10 @@ def main():
         sys.exit(1)
 
     f = open(sys.argv[2])
-    runConfigFile(sys.argv[1], f)
+    result = runConfigFile(sys.argv[1], f)
+    if result is False:
+        return -1
+    return 0
 
 if __name__ == '__main__':
-    main()
+    sys.exit(main())





More information about the tor-commits mailing list