Handle adb error cases more gracefully

We now print a sensible message if we can't find `dart` or `adb`. Also, we
print a sensible message if the device isn't authorized.

Fixes #380
Fixes #358
This commit is contained in:
Adam Barth
2015-11-17 23:23:30 -08:00
parent b065036a0a
commit 3027497f85
2 changed files with 23 additions and 0 deletions

View File

@@ -3,6 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
export FLUTTER_ROOT=$(dirname $(dirname "${BASH_SOURCE[0]}"))
FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
SNAPSHOT_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.snapshot"
@@ -20,6 +22,8 @@ if [ ! -f "$SNAPSHOT_PATH" ] || [ ! -f "$STAMP_PATH" ] || [ `cat "$STAMP_PATH"`
echo -n $REVISION > "$STAMP_PATH"
fi
set +e
$DART "$SNAPSHOT_PATH" "$@"
# The VM exits with code 253 if the snapshot version is out-of-date.
@@ -29,5 +33,7 @@ if [ $EXIT_CODE != 253 ]; then
exit $EXIT_CODE
fi
set -e
$DART --snapshot="$SNAPSHOT_PATH" --package-root="$FLUTTER_TOOLS_DIR/packages" "$SCRIPT_PATH"
$DART "$SNAPSHOT_PATH" "$@"