Skip to content

Move away from cross-spawn - #1251

Merged
sindresorhus merged 1 commit into
mainfrom
inline-cross-spawn
Jul 5, 2026
Merged

sindresorhus merged 1 commit into
mainfrom
inline-cross-spawn

Conversation

@sindresorhus

@sindresorhus sindresorhus commented Jul 4, 2026 •

Copy link
Copy Markdown
Owner

Fixes #578

@sindresorhus sindresorhus changed the title Inline cross spawn Move away from cross-spawn Jul 4, 2026
@sindresorhus
sindresorhus force-pushed the inline-cross-spawn branch 2 times, most recently from 08f6044 to d02fe20 Compare July 4, 2026 23:38
@sindresorhus
sindresorhus merged commit 4cafc3f into main Jul 5, 2026
18 of 20 checks passed
@sindresorhus
sindresorhus deleted the inline-cross-spawn branch July 5, 2026 00:40
@ehmicky

ehmicky commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

That's amazing. I can't believe all our current tests are passing!
Also the new tests are great.

timotheeguerin added a commit to timotheeguerin/typespec that referenced this pull request Sep 3, 2026
…ft#11852)

execa 10 rewrote how it spawns commands on Windows
([microsoft#1251](sindresorhus/execa#1251), which
replaced `cross-spawn`). It now caret-escapes every argument **twice**
for any `.cmd`/`.bat` file, on the assumption that the batch file is an
npm cmd-shim which re-expands `%*` through a second `cmd.exe` parse.
`cross-spawn` only did that for actual shims under `node_modules/.bin`.

Batch files that inspect their own arguments instead of forwarding them
get the extra carets verbatim and break. Maven's `mvn.cmd` is one of
them:

```bat
if "%~1" == "-f" (
```

so `mvn clean install` spawned through execa dies immediately on Windows
with:

```
The syntax of the command is incorrect.
ExecaError: Command failed with exit code 255: mvn clean install ...
```

This already breaks the `typespec-java` generator build in
typespec-azure, which invokes Maven through execa and takes this
catalog. What execa 10 produces versus 9:

```
cmd.exe /q /d /s /c "…\mvn.cmd ^^^"clean^^^" ^^^"install^^^" …"   # 10.0.1 — mvn.cmd chokes
cmd.exe    /d /s /c "…\mvn.cmd ^"clean^" ^"install^" …"           # 9.6.1  — works
```

There is no upstream issue or fixed release yet (10.0.1 is latest), so
this pins the catalog back to `^9.6.1` with a comment. Nothing in this
repo uses the execa 10 API surface (`nodeChildProcess`,
`killDescendants`, the new stream methods), so the downgrade is a no-op
here beyond the Windows behavior.
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.

Get rid of cross-spawn dependency

2 participants