Skip to content

Commit

Permalink
closes #59 use devnull for open descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Quast committed Jan 12, 2020
1 parent 3c443a2 commit 8c2b393
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 2 additions & 8 deletions blessed/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,9 @@ def __init__(self, kind=None, stream=None, force_styling=False):
self._kind = kind or os.environ.get('TERM', 'unknown')

if self.does_styling:
# Initialize curses (call setupterm).
#
# Make things like tigetstr() work. Explicit args make setupterm()
# work even when -s is passed to nosetests. Lean toward sending
# init sequences to the stream if it has a file descriptor, and
# send them to stdout as a fallback, since they have to go
# somewhere.
# Initialize curses (call setupterm), so things like tigetstr() work.
try:
curses.setupterm(self._kind, self._init_descriptor)
curses.setupterm(kind, open(os.devnull).fileno())
except curses.error as err:
warnings.warn('Failed to setupterm(kind={0!r}): {1}'
.format(self._kind, err))
Expand Down
2 changes: 2 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Version History
24-bit color codes instead.
* deprecated: additional key names, such as ``KEY_TAB``, are no longer "injected" into
the curses module namespace.
* deprecated: :func:`curses.setupterm` is now called with :attr:`os.devnull`
as the file descriptor, let us know if this causes any issues. :ghissue:`59`.

1.16
* introduced: Windows support?! :ghissue:`110` by :ghuser:`avylove`.
Expand Down

0 comments on commit 8c2b393

Please sign in to comment.