diff options
| author | Olcan <[email protected]> | 2025-04-21 12:39:58 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-21 12:39:58 -0700 |
| commit | 2571e071751681338518c2bf65f25ad32b2f71f4 (patch) | |
| tree | d09fb6aba3d09ea2e38c90894a523f422a516d9c /scripts/start_sandbox.sh | |
| parent | 53a5728009adf1e91115ee0eb839eafa00262adf (diff) | |
enable debugging through sandbox (#88)
Diffstat (limited to 'scripts/start_sandbox.sh')
| -rwxr-xr-x | scripts/start_sandbox.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/start_sandbox.sh b/scripts/start_sandbox.sh index b30e81bf..efa8ecc2 100755 --- a/scripts/start_sandbox.sh +++ b/scripts/start_sandbox.sh @@ -17,7 +17,8 @@ set -euo pipefail IMAGE=gemini-code-sandbox WORKDIR=/sandbox/$(basename "$PWD") -CLI_DIST=/usr/local/share/npm-global/lib/node_modules/\@gemini-code/cli +CLI_PATH=/usr/local/share/npm-global/lib/node_modules/\@gemini-code/cli +DEBUG_PORT=9229 # use docker if installed, otherwise try to use podman instead if command -v docker &> /dev/null; then @@ -42,6 +43,14 @@ while $CMD ps -a --format "{{.Names}}" | grep -q "$IMAGE-$INDEX"; do done run_args+=(--name "$IMAGE-$INDEX") +# enable debugging via node --inspect-brk (and $DEBUG_PORT) if DEBUG is set +node_args=() +if [ -n "${DEBUG:-}" ]; then + node_args+=(--inspect-brk="0.0.0.0:$DEBUG_PORT") + run_args+=(-p "$DEBUG_PORT:$DEBUG_PORT") +fi +node_args+=("$CLI_PATH" "$@") + # run gemini-code in sandbox container # use empty --authfile to skip unnecessary auth refresh overhead -$CMD run "${run_args[@]}" --authfile <(echo '{}') --workdir "$WORKDIR" "$IMAGE" node "$CLI_DIST" "$@"
\ No newline at end of file +$CMD run "${run_args[@]}" --init --authfile <(echo '{}') --workdir "$WORKDIR" "$IMAGE" node "${node_args[@]}"
\ No newline at end of file |
