From bb05c0698c67985c06a0accba939fe070492f86a Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Sat, 13 Apr 2024 11:59:46 -0700 Subject: [PATCH] Bugfix handling of exceptions in parse_args_and_env --- vpn_slice/__main__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vpn_slice/__main__.py b/vpn_slice/__main__.py index 16a91f7..f341bbe 100755 --- a/vpn_slice/__main__.py +++ b/vpn_slice/__main__.py @@ -541,8 +541,10 @@ def finalize_args_and_env(args, env): def main(args=None, environ=os.environ): global providers + self_test = False try: p, args, env = parse_args_and_env(args, environ) + self_test = args.self_test # Set platform-specific providers providers = slurpy() @@ -578,14 +580,14 @@ def main(args=None, environ=os.environ): finalize_args_and_env(args, env) except Exception as e: - if args.self_test: + if self_test: print('******************************************************************************************', file=stderr) print('*** Self-test did not pass. Double-check that you are running as root (e.g. with sudo) ***', file=stderr) print('******************************************************************************************', file=stderr) raise SystemExit(*e.args) else: - if args.self_test: + if self_test: print('***************************************************************************', file=stderr) print('*** Self-test passed. Try using vpn-slice with openconnect or vpnc now. ***', file=stderr) print('***************************************************************************', file=stderr)