app/django/core/management/color.py
changeset 323 ff1a9aa48cfd
parent 54 03e267d67478
equal deleted inserted replaced
322:6641e941ef1e 323:ff1a9aa48cfd
     9 def supports_color():
     9 def supports_color():
    10     """
    10     """
    11     Returns True if the running system's terminal supports color, and False
    11     Returns True if the running system's terminal supports color, and False
    12     otherwise.
    12     otherwise.
    13     """
    13     """
    14     unsupported_platform = (sys.platform in ('win32', 'Pocket PC')
    14     unsupported_platform = (sys.platform in ('win32', 'Pocket PC'))
    15                             or sys.platform.startswith('java'))
       
    16     # isatty is not always implemented, #6223.
    15     # isatty is not always implemented, #6223.
    17     is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
    16     is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
    18     if unsupported_platform or not is_a_tty:
    17     if unsupported_platform or not is_a_tty:
    19         return False
    18         return False
    20     return True
    19     return True