summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/spack/env/cc46
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 4a3e6eddc9..91916c4532 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -153,6 +153,29 @@ fi
# Save original command for debug logging
input_command="$@"
+#
+# Filter '.' and Spack environment directories out of PATH so that
+# this script doesn't just call itself
+#
+IFS=':' read -ra env_path <<< "$PATH"
+IFS=':' read -ra spack_env_dirs <<< "$SPACK_ENV_PATH"
+spack_env_dirs+=(".")
+PATH=""
+for dir in "${env_path[@]}"; do
+ remove=""
+ for rm_dir in "${spack_env_dirs[@]}"; do
+ if [ "$dir" = "$rm_dir" ]; then remove=True; fi
+ done
+ if [ -z "$remove" ]; then
+ if [ -z "$PATH" ]; then
+ PATH="$dir"
+ else
+ PATH="$PATH:$dir"
+ fi
+ fi
+done
+export PATH
+
if [ "$mode" == vcheck ] ; then
exec ${command} "$@"
fi
@@ -317,29 +340,6 @@ unset LD_LIBRARY_PATH
unset LD_RUN_PATH
unset DYLD_LIBRARY_PATH
-#
-# Filter '.' and Spack environment directories out of PATH so that
-# this script doesn't just call itself
-#
-IFS=':' read -ra env_path <<< "$PATH"
-IFS=':' read -ra spack_env_dirs <<< "$SPACK_ENV_PATH"
-spack_env_dirs+=(".")
-PATH=""
-for dir in "${env_path[@]}"; do
- remove=""
- for rm_dir in "${spack_env_dirs[@]}"; do
- if [ "$dir" = "$rm_dir" ]; then remove=True; fi
- done
- if [ -z "$remove" ]; then
- if [ -z "$PATH" ]; then
- PATH="$dir"
- else
- PATH="$PATH:$dir"
- fi
- fi
-done
-export PATH
-
full_command=("$command")
full_command+=("${args[@]}")