Skip to content

Commit

Permalink
Fix terminal being in improper state when menu.show fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien 🌱 committed Sep 14, 2022
1 parent c754097 commit 45dc11d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/nyaadl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.2.0'
__version__ = '0.2.1'
__title__ = 'nyaadl'
6 changes: 5 additions & 1 deletion src/nyaadl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def show_term_menu(items: list[MenuItem]):
preview_command=str,
clear_screen=True,
)
index = menu.show()
try:
index = menu.show()
except Exception as e:
menu._reset_term()
raise e
if index is None:
return None
return items[index].target
Expand Down

0 comments on commit 45dc11d

Please sign in to comment.