strip json comments in newly created sandbox_command.js (consistent w/ bash version) (#886)

This commit is contained in:
Olcan 2025-06-10 00:33:42 -07:00 committed by GitHub
parent c7e82965b1
commit 749c010a0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,7 @@
import { execSync } from 'child_process';
import { existsSync, readFileSync } from 'fs';
import { join, dirname } from 'path';
import stripJsonComments from 'strip-json-comments';
import os from 'os';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
@ -36,7 +37,9 @@ let geminiSandbox = process.env.GEMINI_SANDBOX;
if (!geminiSandbox) {
const userSettingsFile = join(os.homedir(), '.gemini', 'settings.json');
if (existsSync(userSettingsFile)) {
const settings = JSON.parse(readFileSync(userSettingsFile, 'utf-8'));
const settings = JSON.parse(
stripJsonComments(readFileSync(userSettingsFile, 'utf-8')),
);
if (settings.sandbox) {
geminiSandbox = settings.sandbox;
}