pass PATH and PYTHONPATH into sandbox, let sandbox scripts recognize user settings for sandbox (#247)

This commit is contained in:
Olcan 2025-05-02 12:04:22 -07:00 committed by GitHub
parent b9da7290e1
commit f237082c37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 2 deletions

View file

@ -31,6 +31,16 @@ while getopts ":q" opt; do
done
shift $((OPTIND - 1))
# if GEMINI_CODE_SANDBOX is not set, see if it is set in user settings
# note it can be string or boolean, and if missing jq will return null
USER_SETTINGS_FILE=~/.gemini/settings.json
if [ -z "${GEMINI_CODE_SANDBOX:-}" ] && [ -f "$USER_SETTINGS_FILE" ]; then
USER_SANDBOX_SETTING=$(jq -r '.sandbox' "$USER_SETTINGS_FILE")
if [ "$USER_SANDBOX_SETTING" != null ]; then
GEMINI_CODE_SANDBOX=$USER_SANDBOX_SETTING
fi
fi
# if GEMINI_CODE_SANDBOX is not set, try to source .env in case set there
# allow .env to be in any ancestor directory (same as findEnvFile in config.ts)
if [ -z "${GEMINI_CODE_SANDBOX:-}" ]; then