Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions latexrun
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,16 @@ hash_cache = HashCache()

class _Terminfo:
def __init__(self):
self.__tty = os.isatty(sys.stdout.fileno())
if self.__tty:
curses.setupterm()
self.__tty = False
if os.isatty(sys.stdout.fileno()):
self.setupterm()
self.__ti = {}

def setupterm(self):
if not self.__tty:
self.__tty = True
curses.setupterm()

def __ensure(self, cap):
if cap not in self.__ti:
if not self.__tty:
Expand Down Expand Up @@ -484,6 +489,7 @@ class Message(collections.namedtuple(
cls._color = False
elif state == 'always':
cls._color = True
terminfo.setupterm()
elif state == 'auto':
cls._color = terminfo.has('setaf', 'bold', 'sgr0')
else:
Expand Down