From 62ebe7200e56fecc003ae85c03c96dab2abb6808 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Fri, 6 Jan 2017 12:27:39 -0800 Subject: [PATCH] zephyr-env: don't fail unnecesarily when 'set -e' The way the PATH modification bit was set was failing unnecesarily when the shell is being ran with -e (fail on error), which is leading to unnecessary (and dangerous) workarounds in integration scripts. So wrap it in an if sentence, so the shell doesn't bail out when the grep fails to find the scripts_path in PATH. Change-Id: Ia88a5f430e08ef4c186d11834f4cd840ccd29f7f Signed-off-by: Inaky Perez-Gonzalez --- zephyr-env.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zephyr-env.sh b/zephyr-env.sh index 8bcc2b1236..f81c6382f9 100644 --- a/zephyr-env.sh +++ b/zephyr-env.sh @@ -52,8 +52,9 @@ export ZEPHYR_BASE=$( builtin cd "$( dirname "$DIR" )" && pwd ${MINGW_OPT}) scripts_path=${ZEPHYR_BASE}/scripts scripts_path=$(echo "/$scripts_path" | sed 's/\\/\//g' | sed 's/://') -echo "${PATH}" | grep -q "${scripts_path}" -[ $? != 0 ] && export PATH=${scripts_path}:${PATH} +if ! echo "${PATH}" | grep -q "${scripts_path}"; then + export PATH=${scripts_path}:${PATH} +fi unset scripts_path # enable custom environment settings