Skip to content

Commit

Permalink
fix: do not abort when no version is available (#298)
Browse files Browse the repository at this point in the history
* fix: do not abort when no version is available

* chore: add test to prove correct behaviour

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
Chumper and viceice authored Feb 12, 2022
1 parent 515f3b2 commit 2760ecc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/usr/local/buildpack/utils/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function get_tool_version () {

version_path=$(get_version_path)

cat "${version_path}/${tool}" 2>&-
cat "${version_path}/${tool}" 2>&- || true
}

# Gets the version env var for the given tool
Expand Down
4 changes: 4 additions & 0 deletions test/bash/version.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ teardown() {
run setup_directories
assert_success

run get_tool_version foo
assert_success
assert_output ""

run set_tool_version
assert_failure

Expand Down

0 comments on commit 2760ecc

Please sign in to comment.