Skip to content

Commit

Permalink
zephyr-env: don't fail unnecesarily when 'set -e'
Browse files Browse the repository at this point in the history
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 <inaky.perez-gonzalez@intel.com>
  • Loading branch information
inaky-intc authored and Andrew Boie committed Jan 7, 2017
1 parent a1d7794 commit 62ebe72
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zephyr-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62ebe72

Please sign in to comment.