Exit with error message when run as root (#8626)

This commit is contained in:
Chris Bracken 2017-03-07 13:58:48 -08:00 committed by GitHub
parent a4125f3b0e
commit 81b81d3087

View File

@ -46,6 +46,15 @@ DART_SDK_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk"
DART="$DART_SDK_PATH/bin/dart"
PUB="$DART_SDK_PATH/bin/pub"
# Test if running as superuser
if [[ "$EUID" == "0" ]]; then
echo " Woah! You appear to be trying to run flutter as root."
echo " We strongly recommend running the flutter tool without superuser privileges."
echo " /"
echo "📎"
exit 1
fi
# Test if Git is available on the Host
if ! hash git 2>/dev/null; then
echo "Error: Unable to find git in your PATH."