ART: suppress control characters in scripts without a tty
Makes LUCI output slightly more readable.
Test: manual
Change-Id: I00d51fe3815ded5e1478081e1b170c1eea200e6e
diff --git a/tools/cleanup-buildbot-device.sh b/tools/cleanup-buildbot-device.sh
index 694c739..ebd6163 100755
--- a/tools/cleanup-buildbot-device.sh
+++ b/tools/cleanup-buildbot-device.sh
@@ -14,8 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-green='\033[0;32m'
-nc='\033[0m'
+if [ -t 1 ]; then
+ # Color sequences if terminal is a tty.
+ green='\033[0;32m'
+ nc='\033[0m'
+fi
# Setup as root, as device cleanup requires it.
adb root