Skip to content

[Bug]: editor command fails with EINVAL when EDITOR is a bat file on Windows #88

@tlfay

Description

@tlfay

What happened?

On Windows, the /editor command fails with an EINVAL error when the EDITOR environment variable points to a .bat (batch) file.

Auggie displays:

Editor error: spawnSync C:\path\to\my-editor.bat EINVAL

What did you expect to happen?

The external editor should open with the current input content.

Steps to reproduce

Steps to reproduce:

  1. Set EDITOR environment variable to a .bat file, e.g.: set EDITOR=C:\path\to\my-editor.bat
  2. Launch auggie
  3. Type /editor or press Ctrl+O

Auggie version

0.17.0 (commit 8f26412e)

Request ID

No messages found

Environment details

Environment
  • OS: Windows 11
  • Shell: powershell 7.5.4
  • Tool/CLI version:

Anything else we need to know?

Possible root cause:

Node.js's spawnSync() cannot directly execute .bat files on Windows. Batch files must be run through cmd.exe /c or by using the shell: true option in the spawn options (see https://nodejs.org/api/child_process.html#spawning-bat-and-cmd-files-on-windows).

Suggested fix:

When spawning the editor process on Windows, either:

  1. Use shell: true in the spawn options, or
  2. Detect .bat/.cmd extensions and spawn via cmd.exe /c <editor> <args>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions