[Updater] Do not use color if stdout is not tty am: 57a3bdcdc7
am: 83dbc07985
Change-Id: Ic610de53f880398deb0da6789be2f004e9209ba8
diff --git a/external_updater.py b/external_updater.py
index 5e2e944..d2be334 100644
--- a/external_updater.py
+++ b/external_updater.py
@@ -21,6 +21,7 @@
import argparse
import json
import os
+import sys
import subprocess
import time
@@ -35,9 +36,12 @@
UPDATERS = [GithubArchiveUpdater, GitUpdater]
+USE_COLOR = sys.stdout.isatty()
def color_string(string, color):
"""Changes the color of a string when print to terminal."""
+ if not USE_COLOR:
+ return string
colors = {
'FRESH': '\x1b[32m',
'STALE': '\x1b[31;1m',