Catch more potential errors when setting up curses.

This commit is contained in:
Felix Fontein 2021-02-12 21:14:29 +01:00 committed by Matt Clay
parent f0ec10dbc3
commit ff0edca8cc
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "pause - catch additional error on setting up curses (https://github.com/ansible/ansible/pull/73588)."

View file

@ -40,12 +40,13 @@ display = Display()
try: try:
import curses import curses
import io
# Nest the try except since curses.error is not available if curses did not import # Nest the try except since curses.error is not available if curses did not import
try: try:
curses.setupterm() curses.setupterm()
HAS_CURSES = True HAS_CURSES = True
except (curses.error, TypeError): except (curses.error, TypeError, io.UnsupportedOperation):
HAS_CURSES = False HAS_CURSES = False
except ImportError: except ImportError:
HAS_CURSES = False HAS_CURSES = False