os.isatty is now forbidden (as stream.fileno() is not implemented by StringIO)

Use stream.isatty() instead.
This commit is contained in:
Romain Bignon 2014-10-07 09:37:41 +02:00
commit 5bd70c564f
5 changed files with 9 additions and 8 deletions

View file

@ -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)