os.isatty is now forbidden (as stream.fileno() is not implemented by StringIO)
Use stream.isatty() instead.
This commit is contained in:
parent
8508f951f5
commit
5bd70c564f
5 changed files with 9 additions and 8 deletions
|
|
@ -64,7 +64,7 @@ class ConsoleApplication(Application):
|
|||
|
||||
# shell escape strings
|
||||
if sys.platform == 'win32' \
|
||||
or not os.isatty(sys.stdout.fileno()) \
|
||||
or not sys.stdout.isatty() \
|
||||
or os.getenv('ANSI_COLORS_DISABLED') is not None:
|
||||
#workaround to disable bold
|
||||
BOLD = ''
|
||||
|
|
@ -120,7 +120,7 @@ class ConsoleApplication(Application):
|
|||
def check_loaded_backends(self, default_config=None):
|
||||
while len(self.enabled_backends) == 0:
|
||||
print('Warning: there is currently no configured backend for %s' % self.APPNAME)
|
||||
if not os.isatty(self.stdout.fileno()) or not self.ask('Do you want to configure backends?', default=True):
|
||||
if not self.stdout.isatty() or not self.ask('Do you want to configure backends?', default=True):
|
||||
return False
|
||||
|
||||
self.prompt_create_backends(default_config)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class IFormatter(object):
|
|||
NC = ConsoleApplication.NC
|
||||
|
||||
def colored(self, string, color, attrs=None, on_color=None):
|
||||
if self.outfile != sys.stdout or not (os.isatty(self.outfile.fileno())):
|
||||
if self.outfile != sys.stdout or not self.outfile.isatty():
|
||||
return string
|
||||
|
||||
if isinstance(attrs, basestring):
|
||||
|
|
@ -100,7 +100,7 @@ class IFormatter(object):
|
|||
self.outfile = outfile
|
||||
# XXX if stdin is not a tty, it seems that the command fails.
|
||||
|
||||
if os.isatty(sys.stdout.fileno()) and os.isatty(sys.stdin.fileno()):
|
||||
if sys.stdout.isatty() and sys.stdin.isatty():
|
||||
if sys.platform == 'win32':
|
||||
self.termrows = WConio.gettextinfo()[8]
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue