Skip to content

fix: run checker binaries without a shell - #795

Open
Artur- wants to merge 3 commits into
fi3ework:mainfrom
Artur-:no-shell-spawn
Open

fix: run checker binaries without a shell#795
Artur- wants to merge 3 commits into
fi3ework:mainfrom
Artur-:no-shell-spawn

Conversation

@Artur-

@Artur- Artur- commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The build command was assembled into one string and handed to a shell, which splits it on whitespace. Anything the checkers built that could contain a space therefore fell apart: a project under a directory with a space in its name reached tsc as two arguments and failed with "TS5042: Option 'project' cannot be mixed with source files on a command line". Node concatenates args under shell: true without escaping them, and deprecates the combination for this reason (DEP0190).

Spawn the binaries through cross-spawn with the arguments as a list and no shell, so nothing needs escaping. cross-spawn is what makes that work on Windows, where the binaries in node_modules/.bin are .cmd shims that Node refuses to run without a shell.

The arguments now have to arrive already separated, since no shell is left to do it: the eslint and stylelint commands and biome's flags are split with the same quote aware parser the oxlint checker already uses, so a quoted argument stays whole and loses its quotes exactly as before. The empty string that used to be passed when there is no lint command is gone too; a shell dropped it, a list would not.

One behaviour change comes with this: an unquoted glob in a lint command is no longer expanded by the shell before the linter sees it. Both eslint and stylelint expand globs themselves, and cmd.exe never expanded them, so this makes the platforms agree.

The build command was assembled into one string and handed to a shell,
which splits it on whitespace. Anything the checkers built that could
contain a space therefore fell apart: a project under a directory with a
space in its name reached tsc as two arguments and failed with "TS5042:
Option 'project' cannot be mixed with source files on a command line".
Node concatenates args under `shell: true` without escaping them, and
deprecates the combination for this reason (DEP0190).

Spawn the binaries through cross-spawn with the arguments as a list and
no shell, so nothing needs escaping. cross-spawn is what makes that work
on Windows, where the binaries in node_modules/.bin are .cmd shims that
Node refuses to run without a shell.

The arguments now have to arrive already separated, since no shell is
left to do it: the eslint and stylelint commands and biome's flags are
split with the same quote aware parser the oxlint checker already uses,
so a quoted argument stays whole and loses its quotes exactly as before.
The empty string that used to be passed when there is no lint command is
gone too; a shell dropped it, a list would not.

One behaviour change comes with this: an unquoted glob in a lint command
is no longer expanded by the shell before the linter sees it. Both eslint
and stylelint expand globs themselves, and cmd.exe never expanded them,
so this makes the platforms agree.
@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for vite-plugin-checker ready!

Name Link
🔨 Latest commit 0a5db9f
🔍 Latest deploy log https://app.netlify.com/projects/vite-plugin-checker/deploys/6a8443351af43f0008ddd83b
😎 Deploy Preview https://deploy-preview-795--vite-plugin-checker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/vite-plugin-checker@795

commit: 0a5db9f

@Artur-

Artur- commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

This is an alternative to #792. Potentially resolves #786 also

The checker joins the project path with `path.join`, which returns
backslashes on Windows, while the assertion spelled the path with forward
slashes and only held on POSIX.
@Artur-

Artur- commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

#796 fixes the test failure

@Artur-

Artur- commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@danielroe you working on this project?

@danielroe

Copy link
Copy Markdown
Collaborator

@Artur- I am indeed. why do you ask?

@Artur-

Artur- commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Excellent, just looking for somebody to review or discuss this change. Seems like it solves a couple of issues with deprecation warnings seen with the newest node in addition to properly escaping arguments such as paths with space. In our case, we have an issue with using typescript: { root: 'some path' }

@Artur-

Artur- commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

The alternative solution in #792 sounds much worse

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.

2 participants