From 4cb7386ec65b1c71aec4cec2600d43511f9323ef Mon Sep 17 00:00:00 2001 From: Olcan Date: Tue, 29 Apr 2025 10:21:09 -0700 Subject: [PATCH] allow command -v to fail (#212) --- packages/cli/src/gemini.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/gemini.ts b/packages/cli/src/gemini.ts index 3ac52a8e..15bb9904 100644 --- a/packages/cli/src/gemini.ts +++ b/packages/cli/src/gemini.ts @@ -25,12 +25,11 @@ const __dirname = dirname(__filename); // node.js equivalent of scripts/sandbox_command.sh function sandbox_command(): string { const sandbox = process.env.GEMINI_CODE_SANDBOX?.toLowerCase().trim() ?? ''; - const opts: object = { stdio: 'ignore' }; if (['1', 'true'].includes(sandbox)) { // look for docker or podman, in that order - if (execSync('command -v docker').toString().trim()) { + if (execSync('command -v docker || true').toString().trim()) { return 'docker'; // Set sandbox to 'docker' if found - } else if (execSync('command -v podman').toString().trim()) { + } else if (execSync('command -v podman || true').toString().trim()) { return 'podman'; // Set sandbox to 'podman' if found } else { console.error( @@ -41,7 +40,7 @@ function sandbox_command(): string { } } else if (sandbox) { // confirm that specfied command exists - if (execSync(`command -v ${sandbox}`).toString().trim()) { + if (execSync(`command -v ${sandbox} || true`).toString().trim()) { return sandbox; } else { console.error(