Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/cli/src/utils/sandboxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ export function entrypoint(workdir: string, cliArgs: string[]): string[] {
);

const quotedCliArgs = cliArgs.slice(2).map((arg) => quote([arg]));
const isDebugMode =
process.env['DEBUG'] === 'true' || process.env['DEBUG'] === '1';
const cliCmd =
process.env['NODE_ENV'] === 'development'
? process.env['DEBUG']
? isDebugMode
? 'npm run debug --'
: 'npm rebuild && npm run start --'
: process.env['DEBUG']
: isDebugMode
? `node --inspect-brk=0.0.0.0:${process.env['DEBUG_PORT'] || '9229'} $(which gemini)`
: 'gemini';

Expand Down
6 changes: 4 additions & 2 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ try {
// if debugging is enabled and sandboxing is disabled, use --inspect-brk flag
// note with sandboxing this flag is passed to the binary inside the sandbox
// inside sandbox SANDBOX should be set and sandbox_command.js should fail
if (process.env.DEBUG && !sandboxCommand) {
const isInDebugMode = process.env.DEBUG === '1' || process.env.DEBUG === 'true';

if (isInDebugMode && !sandboxCommand) {
if (process.env.SANDBOX) {
const port = process.env.DEBUG_PORT || '9229';
nodeArgs.push(`--inspect-brk=0.0.0.0:${port}`);
Expand All @@ -64,7 +66,7 @@ const env = {
DEV: 'true',
};

if (process.env.DEBUG) {
if (isInDebugMode) {
// If this is not set, the debugger will pause on the outer process rather
// than the relaunched process making it harder to debug.
env.GEMINI_CLI_NO_RELAUNCH = 'true';
Expand Down