Skip to content

fix: escape composed executable paths on Windows - #153

Open
lorenzotumini wants to merge 1 commit into
CRAG666:mainfrom
lorenzotumini:fix/windows-executable-path-minimal
Open

fix: escape composed executable paths on Windows#153
lorenzotumini wants to merge 1 commit into
CRAG666:mainfrom
lorenzotumini:fix/windows-executable-path-minimal

Conversation

@lorenzotumini

@lorenzotumini lorenzotumini commented Aug 17, 2026

Copy link
Copy Markdown

Problem

#148 fixed paths containing whitespace by shell-escaping each substituted variable. On Windows, the default compiled-language commands now expand $dir/$fileNameWithoutExt into two separately quoted fragments:

"C:\path\to\dir"/"program"

When Neovim passes this through cmd.exe, the directory is interpreted as the command and the compiled executable is not launched.

Fix

Expand $dir/$fileNameWithoutExt and its backslash variant as one complete path before processing individual variables, then shell-escape that complete path.

This preserves the existing placeholder API and user configurations while retaining the whitespace fix from #148. Replacement callbacks ensure that % characters in paths remain literal.

Testing

  • Full test suite under WSL/Linux: 124 passed, 0 failed
  • Native Windows with Neovim 0.12.3 and cmd.exe
  • End-to-end C compilation and execution on both Windows and WSL
  • Directory and source filename containing spaces
  • Slash and backslash command variants
  • Default C, C++, and Rust command expansion

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