Fix: build.sh: give validateToolPresence a chance to inform the user (#9776)

Since the build.sh script runs with `set -e` (exit _immediately_ in case
of error), we cannot first call the `which` command and, on a susequent
line, check its exit status with $?, it would be too late. Instead, we
idiomatically check on the same line of the invocation of `which`.

From the confusing:

    $ make bin
    ==> Checking for necessary tools...
    make: *** [bin] Error 1

To the informative:

    $ make bin
    ==> Checking for necessary tools...
    realpath is not on the path. Exiting...
    make: *** [bin] Error 1
This commit is contained in:
Marco Molteni 2020-08-17 03:37:12 +02:00 committed by GitHub
parent d486459a00
commit 1a248e4868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -13,8 +13,7 @@ set -e
function validateToolPresence
{
local TOOLNAME=$1
which ${TOOLNAME} >/dev/null
if [ $? -ne 0 ]; then
if ! which ${TOOLNAME} >/dev/null; then
echo "${TOOLNAME} is not on the path. Exiting..."
exit 1
fi