Skip to content

Windows: spawn ENOENT and EISDIR errors prevent review/adversarial-review #116

@staffanbergvall

Description

@staffanbergvall

Bug Report

Two issues prevent the plugin from working on Windows.

1. spawn codex ENOENT — missing shell: true on Windows

File: scripts/lib/app-server.mjs, line 188

this.proc = spawn("codex", ["app-server"], {
  cwd: this.cwd,
  env: this.options.env,
  stdio: ["pipe", "pipe", "pipe"]
});

On Windows, codex is installed via npm as a .cmd shim (codex.cmd). Node.js spawn() without shell: true cannot execute .cmd files, resulting in ENOENT.

Note: scripts/lib/process.mjs already handles this correctly at line 11:

shell: process.platform === "win32"

Fix:

this.proc = spawn("codex", ["app-server"], {
  cwd: this.cwd,
  env: this.options.env,
  stdio: ["pipe", "pipe", "pipe"],
  shell: process.platform === "win32"
});

2. EISDIR: illegal operation on a directory, read — untracked directories crash review

File: scripts/lib/git.mjs, line 136-148

function formatUntrackedFile(cwd, relativePath) {
  const absolutePath = path.join(cwd, relativePath);
  const stat = fs.statSync(absolutePath);
  // ... no directory check ...
  const buffer = fs.readFileSync(absolutePath); // EISDIR if directory

git status --short lists untracked directories (e.g., .claude/, data/). The function assumes all entries are files and calls readFileSync on directories, which throws EISDIR.

Fix: Add a directory check:

function formatUntrackedFile(cwd, relativePath) {
  const absolutePath = path.join(cwd, relativePath);
  const stat = fs.statSync(absolutePath);
  if (stat.isDirectory()) {
    return `### ${relativePath}\n(skipped: directory)`;
  }
  // ... rest unchanged

Environment

  • Windows 11 Enterprise 10.0.26200
  • Node.js v20
  • codex-cli 0.112.0
  • Plugin installed via /plugin marketplace add openai/codex-plugin-cc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions