Skip to content

Commit

Permalink
Handle CTRL-C gracefully with console token input
Browse files Browse the repository at this point in the history
Instead of presenting an exception backtrace splat when the user
hits CTRL-C, just give a simple aborted message.

Signed-off-by: David Sommerseth <[email protected]>
  • Loading branch information
dsommers committed Apr 27, 2023
1 parent bce7ba3 commit cf8d143
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions openvpn/connector/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ def main():
token is provided. This token is used by this utility to download the
proper VPN configuration profile and complete the configuration.\n""")

token = input('Enter setup token: ')
print("")
try:
token = input('Enter setup token: ')
print("")
except KeyboardInterrupt:
print('\n\nAborting\n')
sys.exit(0)

else:
token = cliopts.token[0]

Expand Down

0 comments on commit cf8d143

Please sign in to comment.