Skip to content

Commit

Permalink
Run .cmd files through cmd.exe without shell
Browse files Browse the repository at this point in the history
  • Loading branch information
SevInf committed Apr 23, 2024
1 parent 72b178f commit f731448
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions scripts/e2eTestsOnVsix/install_extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ async function installExtension({ extensionType, extensionVersion }) {
console.debug({ vscodeExecutablePath })

// Install VS Code extension
const [cli, ...args] = vscodeTest.resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath)
let [cli, ...args] = vscodeTest.resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath)

console.debug({ cli })
console.debug({ args })

const result = childProcess.spawnSync(cli, ['--install-extension', `${extensionName}@${extensionVersion}`], {
encoding: 'utf-8',
stdio: 'pipe',
shell: true,
})
if (process.platform === 'win32' && cli.endsWith('.cmd')) {
args.unshift(cli)
cli = 'cmd.exe'
}

const result = childProcess.spawnSync(
cli,
[...args, '--install-extension', `${extensionName}@${extensionVersion}`],
{
encoding: 'utf-8',
stdio: 'pipe',
},
)
console.log(result)
if (result.stderr.includes('Failed')) {
console.log("It's not ready to be installed yet.")
Expand Down

0 comments on commit f731448

Please sign in to comment.