Check for empty output in adb_wait_for_charge.
authorbenjaminwagner <benjaminwagner@google.com>
Wed, 29 Jun 2016 14:02:54 +0000 (07:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 29 Jun 2016 14:02:54 +0000 (07:02 -0700)
Example error in https://chromium-swarm.appspot.com/user/task/2f96d6439584e411

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2105813003

Review-Url: https://codereview.chromium.org/2105813003

platform_tools/android/bin/adb_wait_for_charge

index e24773a..f05c44f 100755 (executable)
@@ -54,7 +54,7 @@ function get_battery_level {
   STATS="$($ADB $DEVICE_SERIAL shell dumpsys battery)"
   SPLIT=( $STATS )
   RV="$(_parse_battery_level ${SPLIT[@]})"
-  if [ "$RV" != "-1" ]; then
+  if [ -n "$RV" ] && [ "$RV" != "-1" ]; then
     echo "$RV"
     return
   fi