Skip to content

Commit

Permalink
Bugfix handling of exceptions in parse_args_and_env
Browse files Browse the repository at this point in the history
  • Loading branch information
dlenski committed Apr 13, 2024
1 parent b0140e9 commit bb05c06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vpn_slice/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit bb05c06

Please sign in to comment.