mirror of
https://github.com/kennethreitz/clint.git
synced 2026-06-05 23:00:18 +00:00
More robust checking for if output is a tty
This commit is contained in:
@@ -15,7 +15,10 @@ import time
|
||||
|
||||
STREAM = sys.stderr
|
||||
# Only show bar in terminals by default (better for piping, logging etc.)
|
||||
HIDE_DEFAULT = False if STREAM.isatty() else True
|
||||
try:
|
||||
HIDE_DEFAULT = not STREAM.isatty()
|
||||
except AttributeError: # output does not support isatty()
|
||||
HIDE_DEFAULT = True
|
||||
|
||||
BAR_TEMPLATE = '%s[%s%s] %i/%i - %s\r'
|
||||
MILL_TEMPLATE = '%s %s %i/%i\r'
|
||||
|
||||
Reference in New Issue
Block a user