nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Voice plugin cannot run .cmd or .bat helper commands on Windows (spawn EINVAL)

Open addyCooks opened this issue 1 month ago • 4 comments

Summary

The voice plugin starts REC_CMD, PLAY_CMD, WHISPER_CMD and PIPER_CMD with child_process.spawn and no shell. Node 22 refuses to spawn .cmd and .bat files that way, so helpers installed as shims fail.

Steps to reproduce

  1. On Windows with Node 22, create ok.cmd containing @echo off and exit /b 0.
  2. Set REC_CMD to its full path.
  3. Call recordAudio('test.wav') from the voice plugin. Or run pnpm run test:ava plugins/voice/src/index.spec.ts.

Expected behaviour

The helper runs and recordAudio resolves.

Actual behaviour

Error { code: 'EINVAL', syscall: 'spawn', message: 'spawn EINVAL' }

15 tests in plugins/voice/src/index.spec.ts fail this way. They create their own .cmd mocks, so Windows support was intended. A plain Node spawn('ok.cmd', ['x']) throws the same error.

Environment

Windows 11, Node v22.22.3, Nanocoder 1.31.0 (main at 948a4e74)

Suggested fix

  • Use cross-spawn (already a dependency of the main app and used for LSP after #1690 and #1701) in plugins/voice/src/microphone.ts:37, speaker.ts:36, stt.ts:57, tts.ts:48, dependencies.ts:70 and :232, and vad-worker.ts:63.
  • Or pass shell: true only when the command ends in .cmd or .bat.

addyCooks avatar Nov 02 '26 16:11 addyCooks

hi @addyCooks can you assign this to me

Vishesh-Verma-07 avatar Nov 02 '26 18:11 Vishesh-Verma-07

Hi @Vishesh-Verma-07 , thanks for your interest in this issue! I've already assigned you a few other issues, so please finish those first. Once they are done, let me know here and I'll assign this one to you too. If you get stuck on any of them, feel free to ask questions in the issue or PR.

Happy to help!

addyCooks avatar Nov 03 '26 06:11 addyCooks

Yeah, sure. I'll let you know once I've made the PRs for the previous ones.

Vishesh-Verma-07 avatar Nov 03 '26 06:11 Vishesh-Verma-07

hey @addyCooks done with my previous issues now can you assign this to me

Vishesh-Verma-07 avatar Nov 03 '26 09:11 Vishesh-Verma-07