[stable-2.10] pause - fix curses.setupterm() error (#47851) (#70363)

* [Bugfix] curses.setupterm() error

When run playbook in celery task, curses.setupterm()  will be failed

```
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/guang/.virtualenvs/ansible/lib/python3.6/site-packages/ansible/plugins/action/pause.py", line 45, in <module>
    curses.setupterm()
TypeError: argument must be an int, or have a fileno() method.

```

* Add changelog

Co-authored-by: Sam Doran <sdoran@redhat.com>
(cherry picked from commit c3fc2d27d9)

Co-authored-by: 老广 <ibuler@qq.com>

Co-authored-by: 老广 <ibuler@qq.com>
This commit is contained in:
Sam Doran 2020-07-17 13:57:20 -04:00 committed by GitHub
parent 3afa0424b3
commit 367c9b7eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- pause - handle exception when there is no stdout (https://github.com/ansible/ansible/pull/47851)

View file

@ -41,7 +41,7 @@ try:
try: try:
curses.setupterm() curses.setupterm()
HAS_CURSES = True HAS_CURSES = True
except curses.error: except (curses.error, TypeError):
HAS_CURSES = False HAS_CURSES = False
except ImportError: except ImportError:
HAS_CURSES = False HAS_CURSES = False