Skip to content

Commit ba1bfc1

Browse files
committed
Add a --debug option
Add a --debug option which run "start-tor-browser" with --verbose option and without --detach. This makes the program run in the foreground and log underlying output to console. Closes #435.
1 parent 72b7d24 commit ba1bfc1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

torbrowser_launcher/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def main():
5959
dest="settings",
6060
help="Open Tor Browser Launcher settings",
6161
)
62+
parser.add_argument(
63+
"--debug",
64+
action="store_true",
65+
default=False,
66+
help="Launch browser in debug mode (foreground, log to terminal)",
67+
)
6268
parser.add_argument("url", nargs="*", help="URL to load")
6369
args = parser.parse_args()
6470

@@ -89,7 +95,7 @@ def main():
8995
gui = Settings(common, app)
9096
else:
9197
# Launcher mode
92-
gui = Launcher(common, app, url_list)
98+
gui = Launcher(common, app, url_list, debug=args.debug)
9399

94100
# Center the window
95101
desktop = app.desktop()

torbrowser_launcher/launcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ class Launcher(QtWidgets.QMainWindow):
6464
Launcher window.
6565
"""
6666

67-
def __init__(self, common, app, url_list):
67+
def __init__(self, common, app, url_list, debug=False):
6868
super(Launcher, self).__init__()
6969
self.common = common
7070
self.app = app
7171

7272
self.url_list = url_list
73+
self.debug = debug
7374
self.force_redownload = False
7475

7576
# This is the current version of Tor Browser, which should get updated with every release
@@ -478,7 +479,7 @@ def run(self):
478479

479480
# Run Tor Browser
480481
subprocess.call(
481-
[self.common.paths["tbb"]["start"], "--detach"],
482+
[self.common.paths["tbb"]["start"], "--verbose" if self.debug else "--detach"],
482483
cwd=self.common.paths["tbb"]["dir_tbb"],
483484
)
484485
sys.exit(0)

0 commit comments

Comments
 (0)