diff --git a/vpython b/vpython index 42d112fa7..55fd4aadc 100755 --- a/vpython +++ b/vpython @@ -42,11 +42,15 @@ export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' ' source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" cipd_bin_setup &> /dev/null +# Don't pass this to the Python script as it might turn around and run commands +# in other depot_tools dirs. +base_dir="${DEPOT_TOOLS_DIR}" +unset DEPOT_TOOLS_DIR case "${DEPOT_TOOLS_UNAME_S}" in mingw*|cygwin*) cmd.exe //c $0.bat "$@" ;; *) - exec "${DEPOT_TOOLS_DIR}/.cipd_bin/vpython" "$@" + exec "${base_dir}/.cipd_bin/vpython" "$@" ;; esac diff --git a/vpython3 b/vpython3 index 3f2373dd3..1ff7a2520 100755 --- a/vpython3 +++ b/vpython3 @@ -40,11 +40,15 @@ export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' ' source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" cipd_bin_setup &> /dev/null +# Don't pass this to the Python script as it might turn around and run commands +# in other depot_tools dirs. +base_dir="${DEPOT_TOOLS_DIR}" +unset DEPOT_TOOLS_DIR case "${DEPOT_TOOLS_UNAME_S}" in mingw*|cygwin*) cmd.exe //c $0.bat "$@" ;; *) - exec "${DEPOT_TOOLS_DIR}/.cipd_bin/vpython3" "$@" + exec "${base_dir}/.cipd_bin/vpython3" "$@" ;; esac