diff options
author | Micah Lee <micah@micahflee.com> | 2020-11-29 11:08:46 -0800 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2020-11-29 11:08:46 -0800 |
commit | aecaae896d36b98ee745148f1efe7aa74497b945 (patch) | |
tree | 67cbed7e358b8d4919a871f48bc958386f39658c /cli/onionshare_cli/__init__.py | |
parent | 7bcfe6cad11036feeb52b199a9f0736ff35e21d6 (diff) | |
download | onionshare-aecaae896d36b98ee745148f1efe7aa74497b945.tar.gz onionshare-aecaae896d36b98ee745148f1efe7aa74497b945.zip |
Make CLI throw an error if it cannot find tor binary
Diffstat (limited to 'cli/onionshare_cli/__init__.py')
-rw-r--r-- | cli/onionshare_cli/__init__.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cli/onionshare_cli/__init__.py b/cli/onionshare_cli/__init__.py index 7361ac9e..34627deb 100644 --- a/cli/onionshare_cli/__init__.py +++ b/cli/onionshare_cli/__init__.py @@ -22,7 +22,7 @@ import os, sys, time, argparse, threading from datetime import datetime from datetime import timedelta -from .common import Common +from .common import Common, CannotFindTor from .web import Web from .onion import * from .onionshare import OnionShare @@ -320,7 +320,15 @@ def main(cwd=None): web = Web(common, False, mode_settings, mode) # Start the Onion object - onion = Onion(common, use_tmp_dir=True) + try: + onion = Onion(common, use_tmp_dir=True) + except CannotFindTor: + print("You must install tor to use OnionShare from the command line") + if common.platform == "Darwin": + print("In macOS, you can do this with Homebrew (https://brew.sh):") + print(" brew install tor") + sys.exit() + try: onion.connect( custom_settings=False, |