mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Catch keyboard interrupt when opening journal (#476)
If the journal is encrypted, jrnl asks for a password using the getpass.getpass function. If user presses the keyboard interrupt (e.g. ctrl+c) during the password prompt, jrnl crashes and prints a stack trace. This however is not very user friendly. This commit adds a check for KeyboardInterrupt Exception and prints a message whenever this exception occurs and exits. Stack is no longer printed. Fixes #450
This commit is contained in:
parent
ca2d9f072f
commit
8fe8e00e1b
1 changed files with 5 additions and 1 deletions
|
@ -206,7 +206,11 @@ def run(manual_args=None):
|
||||||
mode_compose = False
|
mode_compose = False
|
||||||
|
|
||||||
# This is where we finally open the journal!
|
# This is where we finally open the journal!
|
||||||
journal = Journal.open_journal(journal_name, config)
|
try:
|
||||||
|
journal = Journal.open_journal(journal_name, config)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
util.prompt("[Interrupted while opening journal]".format(journal_name))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Import mode
|
# Import mode
|
||||||
if mode_import:
|
if mode_import:
|
||||||
|
|
Loading…
Add table
Reference in a new issue