Skip to content

Conversation

dojineko
Copy link

Summary

Fixed an issue where non-executable files could be passed to Spawn on Windows.

Problem

  • In Windows environments, when using the where command to locate gemini, files without extensions may appear as candidates (example below)
  • The current implementation does not specify shell: true for the child_process spawn function
  • This causes ENOENT: no such file or directory, uv_spawn 'gemini' error when files without extensions are passed
# Example
$ where gemini
C:\path\to\gemini
C:\path\to\gemini.cmd

Solution

  • Changed command listing to not depend on external commands
  • On Windows, search for the gemini executable while respecting the PATHEXT environment variable that indicates executable files
    • Avoided specifying shell: true for the spawn function as it caused integration tests to fail

Changes

  • Added findExecutable() function to index.ts
    • Implementation equivalent to which or where commands
  • Modified decideGeminiCliCommand() in index.ts to use findExecutable() when searching for executable files
    • Added related unit tests

Testing

  • Tested on Windows 11: Confirmed that gemini-cli - chat (MCP)(prompt: "hello") executes successfully
  • Tested on Ubuntu (WSL): Confirmed that gemini-cli - chat (MCP)(prompt: "hello") executes successfully
  • Confirmed that prepared tests work on both platforms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant