Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Notification of breaking api change with v1.92 release of VS Code #458

Open
deepak1556 opened this issue Jul 11, 2024 · 2 comments
Open

Comments

@deepak1556
Copy link

Hello from the VS Code team 👋

In our next release v1.92, we will update to Electron 30 which includes Node.js 20.14.0. This Node version contains a breaking change, in response to a CVE, which may affect you if you execute .bat or .cmd files on Windows. Based on a simple scan of your extension's source code, you may be impacted by this change. The stable VS Code that contains this update will be released in early August.

Action: please try out your extension on this month's VS Code Insiders on Windows. If you are affected by this change, you will encounter an EINVAL error when you try to spawn a bat/cmd file.

Node.js has added a section on batch file spawning to their documentation. To fix any issues:

  1. Find locations where you call child_process.spawn to execute a batch file on Windows
  2. Add shell: true or shell: process.platform === 'win32' to the options object
  3. If the batch script path may contain spaces, you will also need to wrap the path in quotation marks.

Please let us know if you run into issues or if you need clarification.

Happy coding!

@neutraali
Copy link

This is currently breaking the flow-for-vscode for Windows users. On startup there's a popup that states that "Flow server stopped", and the output panel shows something like this:

[Error - 00:00:00 PM] Starting client failed
Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:800:9)
    at path\to\vscode\extensions\flowtype.flow-for-vscode-2.2.1\build\index.js:1:156960

@dstorfer-cn
Copy link

This is currently breaking the flow-for-vscode for Windows users. On startup there's a popup that states that "Flow server stopped", and the output panel shows something like this:

[Error - 00:00:00 PM] Starting client failed
Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:800:9)
    at path\to\vscode\extensions\flowtype.flow-for-vscode-2.2.1\build\index.js:1:156960

Hello Everyone,
For Windows users, it just doesn't work anymore.

Is there any chance this will be fixed? I see the last release was nearly two years ago so I'm worried it won't be. Honestly, I would try to update it myself but I have zero experience writing extensions and I wouldn't know the first thing about creating an environment to successfully run and test it. The change appears very small, but the rest looks like a mountain to me.

Thanks,
David

edemaine added a commit to edemaine/flow-for-vscode that referenced this issue Dec 16, 2024
facebook-github-bot pushed a commit to facebook/flow that referenced this issue Dec 16, 2024
Summary:
As reported automatically in flow/flow-for-vscode#458, this plugin needs to engage the shell to launch the LSP on modern VSCode on Windows, because the script is generally installed as `flow-bin/cli.cmd` and only the shell can execute those.

(port of flow/flow-for-vscode#464)

Personally I still have issues using this plugin in my setup, because of the use of [`bin-version`](https://www.npmjs.com/package/bin-version) which calls [`execa`](https://github.com/sindresorhus/execa) which calls [`cross-spawn`](https://github.com/moxystudio/node-cross-spawn), which doesn't seem to support Flow via `yarn` on Windows (which creates `.js` files but no `.cmd`/.bat` file) — not sure exactly why. In the future, I'd suggest moving away from this rather heavy chain of dependencies. Let me know if you'd like a PR to that effect.

Pull Request resolved: #9242

Reviewed By: SamChou19815

Differential Revision: D67295692

fbshipit-source-id: 68e7f68bb6e2593f3579e00a7bbf402b4be0f014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants