[tor-commits] [chutney/master] Debug: set tor --quiet when not debugging

teor at torproject.org teor at torproject.org
Tue Oct 30 11:30:02 UTC 2018


commit 1aa7b8210f84be96c551894e9d16f426d98cd013
Author: teor <teor at torproject.org>
Date:   Tue Oct 23 14:58:44 2018 +1000

    Debug: set tor --quiet when not debugging
    
    And tor-gencert -v when debugging.
---
 lib/chutney/TorNet.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index d59a846..e4465c9 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -105,6 +105,8 @@ def run_tor(cmdline):
 
        Returns the combined stdout and stderr of the process.
     """
+    if not debug_flag:
+        cmdline.append("--quiet")
     try:
         stdouterr = subprocess.check_output(cmdline,
                                             stderr=subprocess.STDOUT,
@@ -133,6 +135,10 @@ def launch_process(cmdline, tor_name="tor", stdin=None):
 
        Returns the Popen object for the launched process.
     """
+    if tor_name == "tor" and not debug_flag:
+        cmdline.append("--quiet")
+    elif tor_name == "tor-gencert" and debug_flag:
+        cmdline.append("-v")
     try:
         p = subprocess.Popen(cmdline,
                              stdin=stdin,
@@ -358,7 +364,7 @@ class LocalNodeBuilder(NodeBuilder):
             cmdline = [
                 tor,
                 "--list-torrc-options",
-                "--hush"]
+                ]
             opts = run_tor(cmdline)
             # check we received a list of options, and nothing else
             assert re.match(r'(^\w+$)+', opts, flags=re.MULTILINE)
@@ -472,7 +478,8 @@ class LocalNodeBuilder(NodeBuilder):
             '-s', skfile,
             '-c', certfile,
             '-m', str(lifetime),
-            '-a', addr]
+            '-a', addr,
+            ]
         print("Creating identity key %s for %s with %s" % (
             idfile, self._env['nick'], " ".join(cmdline)))
         outerr = run_tor_gencert(cmdline, passphrase)
@@ -491,7 +498,6 @@ class LocalNodeBuilder(NodeBuilder):
             "--list-fingerprint",
             "--orport", "1",
             "--datadirectory", datadir,
-            "--quiet",
             ]
         stdouterr = run_tor(cmdline)
         fingerprint = "".join((stdouterr.rstrip().split('\n')[-1]).split()[1:])
@@ -653,7 +659,6 @@ class LocalNodeController(NodeController):
         cmdline = [
             tor_path,
             "-f", torrc,
-            "--quiet",
             ]
         p = launch_process(cmdline)
         if self.waitOnLaunch():





More information about the tor-commits mailing list