File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 67
67
fi
68
68
# Execute the command in a clean environment and capture exported variables
69
69
# Let's use our PATH as a base to have utilities available.
70
- current_envs=$( env -i PATH=" ${PATH} " CURRENT_VARIANT_CONTEXT=" ${context} " bash -c " ${base_command} && export -p" )
70
+ current_envs=$( env -i PWD= " ${PWD} " PATH=" ${PATH} " CURRENT_VARIANT_CONTEXT=" ${context} " bash -c " ${base_command} && export -p" )
71
71
72
72
# `export -p` instead of `env` ensures we can safely re-source variables which we rely on further
73
73
# below like our operator.print.env script
76
76
fi
77
77
78
78
# convert declare -x key=value into key=value
79
- current_envs=$( echo " ${current_envs[@]} " | sed ' s/^declare -x //g' | sed ' s/=/=/' | sort | uniq)
79
+ # filter out variables that don't have value (missing '=')
80
+ current_envs=$( echo " ${current_envs[@]} " | grep ' =' | sed ' s/^declare -x //g' | sed ' s/=/=/' | sort | uniq)
80
81
81
82
echo -e " ## This file is automatically generated by switch_context.sh\n## Do not edit it!" > " ${destination_envs_file} .env"
82
83
# shellcheck disable=SC2129
You can’t perform that action at this time.
0 commit comments