Fix flutter shell script to handle properly shells that have CDPATH set (#17589)

Before this change, if CDPATH was set, and you type (from the flutter root) "bin/flutter --version" you would get an error.

This is because the cd command in follow_links was printing the directory Bash chose from the CDPATH to stdout, causing the path to have a newline in it, which understandably confuses the rest of the script.
This commit is contained in:
Greg Spencer 2018-05-14 17:11:38 -07:00 committed by GitHub
parent a25bbc7bfc
commit ace27819fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,8 @@
set -e
unset CDPATH
function follow_links() {
cd -P "${1%/*}"
local file="$PWD/${1##*/}"