Commit e5163904 authored by zeke's avatar zeke

handle semver match failures

parent c1f13bf0
......@@ -3,8 +3,7 @@
# fail fast
set -e
# Uncomment the line below to enable debugging when
# working on the buildpack
# Uncomment the line below to enable debugging
# set -x
download_and_install_node() {
......
......@@ -30,12 +30,13 @@ if ! test $requested_version; then
else
# Does the already-downloaded stable version of node satisfy the requested version?
default_satisfies=$(node $bp_dir/vendor/semver/bin/semver -v "$stable_version" -r "$requested_version" || echo "")
default_satisfies=$($bp_dir/vendor/semver/bin/semver -v "$stable_version" -r "$requested_version" || echo "")
if test $default_satisfies; then
status "Latest stable node v$stable_version satisfies engines.node: $requested"
status "Latest stable node v$stable_version satisfies engines.node: $requested_version"
node_version=$stable_version
else
# Fetch all versions of node from nodejs.org/dist and format them into
# a string that the semver binary will appreciate.
# e.g. semver -v "0.10.0" -v "0.10.1" -v "0.10.2" -r ">0.8"
......@@ -45,7 +46,7 @@ else
args="${args} -r \"${requested_version}\""
# Find all versions that satisfy.
satisfying_versions=$(eval $bp_dir/vendor/semver/bin/semver ${args})
satisfying_versions=$(eval $bp_dir/vendor/semver/bin/semver ${args} || echo "")
# Use the latest one.
node_version=$(echo "$satisfying_versions" | tail -n 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment