Browse Source

better vendor.sh to break when fail in grep

Signed-off-by: allencloud <allen.sun@daocloud.io>
allencloud 9 năm trước cách đây
mục cha
commit
e06a8dc6be
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      hack/vendor.sh

+ 6 - 1
hack/vendor.sh

@@ -19,7 +19,12 @@ case $# in
 	;;
 # If user passed arguments to the script
 1)
-	eval "$(grep -E "^clone [^ ]+ $1" "$0")"
+	path="$PWD/hack/vendor.sh"
+	if ! cloneGrep="$(grep -E "^clone [^ ]+ $1" "$path")"; then
+		echo >&2 "error: failed to find 'clone ... $1' in $path"
+		exit 1
+	fi
+	eval "$cloneGrep"
 	clean
 	exit 0
 	;;