summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Orion Hodson <oth@google.com> 2019-11-19 15:01:02 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2019-11-19 16:32:16 +0000
commit5697faba0e910374da285f5f848d2aaf7ee6ffec (patch)
tree196548f63269ebaab95b36fafde11b2abb94a7b5
parentfeba2643d0a2426e7a10462abcd3d168ee6a61dd (diff)
ART: suppress control characters in scripts without a tty
Makes LUCI output slightly more readable. Test: manual Change-Id: I00d51fe3815ded5e1478081e1b170c1eea200e6e
-rwxr-xr-xtools/buildbot-sync.sh13
-rwxr-xr-xtools/cleanup-buildbot-device.sh7
-rwxr-xr-xtools/setup-buildbot-device.sh11
-rwxr-xr-xtools/teardown-buildbot-device.sh7
4 files changed, 25 insertions, 13 deletions
diff --git a/tools/buildbot-sync.sh b/tools/buildbot-sync.sh
index fb5927260b..e274fd4fd8 100755
--- a/tools/buildbot-sync.sh
+++ b/tools/buildbot-sync.sh
@@ -16,11 +16,14 @@
# Push ART artifacts and its dependencies to a chroot directory for on-device testing.
-red='\033[0;31m'
-green='\033[0;32m'
-yellow='\033[0;33m'
-magenta='\033[0;35m'
-nc='\033[0m'
+if [ -t 1 ]; then
+ # Color sequences if terminal is a tty.
+ red='\033[0;31m'
+ green='\033[0;32m'
+ yellow='\033[0;33m'
+ magenta='\033[0;35m'
+ nc='\033[0m'
+fi
adb wait-for-device
diff --git a/tools/cleanup-buildbot-device.sh b/tools/cleanup-buildbot-device.sh
index 694c739e07..ebd61639bd 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
diff --git a/tools/setup-buildbot-device.sh b/tools/setup-buildbot-device.sh
index ee623e8b7f..c2451d3d5b 100755
--- a/tools/setup-buildbot-device.sh
+++ b/tools/setup-buildbot-device.sh
@@ -17,10 +17,13 @@
# The work does by this script is (mostly) undone by tools/teardown-buildbot-device.sh.
# Make sure to keep these files in sync.
-red='\033[0;31m'
-green='\033[0;32m'
-yellow='\033[0;33m'
-nc='\033[0m'
+if [ -t 1 ]; then
+ # Color sequences if terminal is a tty.
+ red='\033[0;31m'
+ green='\033[0;32m'
+ yellow='\033[0;33m'
+ nc='\033[0m'
+fi
if [ "$1" = --verbose ]; then
verbose=true
diff --git a/tools/teardown-buildbot-device.sh b/tools/teardown-buildbot-device.sh
index 6324e13118..1ea4cf0da4 100755
--- a/tools/teardown-buildbot-device.sh
+++ b/tools/teardown-buildbot-device.sh
@@ -17,8 +17,11 @@
# This script undoes (most of) the work done by tools/setup-buildbot-device.sh.
# Make sure to keep these files in sync.
-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 some actions performed here require it.
adb root