Home | History | Annotate | Download | only in build
      1 #!/bin/bash
      2 
      3 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
      4 #
      5 # Use of this source code is governed by a BSD-style license
      6 # that can be found in the LICENSE file in the root of the source
      7 # tree. An additional intellectual property rights grant can be found
      8 # in the file PATENTS.  All contributing project authors may
      9 # be found in the AUTHORS file in the root of the source tree.
     10 
     11 # 'adb shell' always returns "0" regardless of executable return code.
     12 # This handy script will return executable return code to shell which
     13 # can be used by buildbots.
     14 
     15 adb_shell () {
     16   local RET ADB_LOG
     17   ADB_LOG=$(mktemp "${TMPDIR:-/tmp}/adb-XXXXXXXX")
     18   adb "$1" "$2" shell "$3" "$4" ";" echo \$? | tee "$ADB_LOG"
     19   sed -i -e 's![[:cntrl:]]!!g' "$ADB_LOG"  # Remove \r.
     20   RET=$(sed -e '$!d' "$ADB_LOG")           # Last line contains status code.
     21   rm -f "$ADB_LOG"
     22   return $RET
     23 }
     24