formatting error: undefined
When I'm trying to format, the output console shows undefined. I have no idea what's wrong. The extension was working fine the other day then it suddenly broke
Hi, I can take a look at this. I am currently unable to repro this issue, do you mind providing a minimal repro and some more information (e.g. CLI version, system, etc.)?
The reason for the error is in this code:
const p = cp.spawn(this.binaryPath, ['format', backupFile], { cwd });
It is intended behavior for the security patch CVE-2024-27980. You must pass shell: true in the option on Windows environment if you need to spawn program ended with .bat or .cmd extension.
The patch is deployed in 18.20.2, 20.12.2, 21.17.3 and also 22.0.0 Details can be found on https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
To fix this, simply add shell: process.platform === "win32" to the params.
const p = cp.spawn(this.binaryPath, ['format', backupFile], { cwd, shell: process.platform === "win32", });
The fix from @clayzx has been merged and released, closing this issue for now. Please feel free to re-open if there are new questions/concerns.