[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [chutney/master] TorNet: Raise a ValueError when an unknown tor_name is used
commit 126e8ec9faddd6f6e969a387138c5472c5b0ea72
Author: teor <teor@xxxxxxxxxxxxxx>
Date: Fri Jan 24 11:02:32 2020 +1000
TorNet: Raise a ValueError when an unknown tor_name is used
Follow-up for 33041.
---
lib/chutney/TorNet.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 1cc1d4e..0da0839 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -218,6 +218,8 @@ def _warnMissingTor(tor_path, cmdline, tor_name="tor"):
help_msg = help_msg_fmt.format("CHUTNEY_TOR", tor_name)
elif tor_name == "tor-gencert":
help_msg = help_msg_fmt.format("CHUTNEY_TOR_GENCERT", tor_name)
+ else:
+ raise ValueError("Unknown tor_name: '{}'".format(tor_name))
print(("Cannot find the {} binary at '{}' for the command line '{}'. {}")
.format(tor_name, tor_path, " ".join(cmdline), help_msg))
@@ -267,10 +269,14 @@ def launch_process(cmdline, tor_name="tor", stdin=None, exit_on_missing=True):
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")
+ if tor_name == "tor":
+ if not debug_flag:
+ cmdline.append("--quiet")
+ elif tor_name == "tor-gencert":
+ if debug_flag:
+ cmdline.append("-v")
+ else:
+ raise ValueError("Unknown tor_name: '{}'".format(tor_name))
try:
p = subprocess.Popen(cmdline,
stdin=stdin,
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits