mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
SANDBOX_SET_UID_GID option for systems where this is necessary (should be only rootful docker on linux w/o userns-remap configured) (#210)
* SANDBOX_SET_UID_GID option for systems where this is necessary (should be only rootful docker on linux w/o userns-remap configured) * Merge remote-tracking branch 'origin/main' into sandbox_uid_gid
This commit is contained in:
@@ -22,15 +22,15 @@ set -euo pipefail
|
||||
QUIET=false
|
||||
while getopts ":q" opt; do
|
||||
case ${opt} in
|
||||
q ) QUIET=true ;;
|
||||
\? ) echo "Usage: $0 [-q]"
|
||||
exit 1
|
||||
;;
|
||||
q) QUIET=true ;;
|
||||
\?)
|
||||
echo "Usage: $0 [-q]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
|
||||
# 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
|
||||
@@ -57,10 +57,10 @@ fi
|
||||
|
||||
# if GEMINI_CODE_SANDBOX is set to 1 or true, then try to use docker or podman
|
||||
if [[ "${GEMINI_CODE_SANDBOX:-}" =~ ^(1|true)$ ]]; then
|
||||
if command -v docker &> /dev/null; then
|
||||
if command -v docker &>/dev/null; then
|
||||
if [ "$QUIET" = false ]; then echo "docker"; fi
|
||||
exit 0
|
||||
elif command -v podman &> /dev/null; then
|
||||
elif command -v podman &>/dev/null; then
|
||||
if [ "$QUIET" = false ]; then echo "podman"; fi
|
||||
exit 0
|
||||
else
|
||||
@@ -69,7 +69,7 @@ if [[ "${GEMINI_CODE_SANDBOX:-}" =~ ^(1|true)$ ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v "$GEMINI_CODE_SANDBOX" &> /dev/null; then
|
||||
if ! command -v "$GEMINI_CODE_SANDBOX" &>/dev/null; then
|
||||
echo "ERROR: missing sandbox command '$GEMINI_CODE_SANDBOX' (from GEMINI_CODE_SANDBOX)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user