Skip to content

Commit

Permalink
Now really try to fix the thing
Browse files Browse the repository at this point in the history
  • Loading branch information
SevInf committed Apr 23, 2024
1 parent 3642277 commit 6c24169
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions scripts/e2eTestsOnVsix/install_extension.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict'
const core = require('@actions/core')
const vscodeTest = require('@vscode/test-electron')
const childProcess = require('child_process')
Expand All @@ -21,19 +22,7 @@ async function installExtension({ extensionType, extensionVersion }) {
console.debug({ cli })
console.debug({ args })

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',
},
)
const result = spawnVscode(cli, ['--install-extension', `${extensionName}@${extensionVersion}`])
console.log(result)
if (result.stderr.includes('Failed')) {
console.log("It's not ready to be installed yet.")
Expand All @@ -49,6 +38,18 @@ async function installExtension({ extensionType, extensionVersion }) {
}
}

function spawnVscode(cmd, args) {
if (process.platform === 'win32' && cmd.endsWith('.cmd')) {
args = [cmd, ...args]
cmd = 'cmd.exe'
}

return childProcess.spawnSync(cmd, args, {
encoding: 'utf-8',
stdio: 'pipe',
})
}

module.exports = { installExtension }

if (require.main === module) {
Expand Down

0 comments on commit 6c24169

Please sign in to comment.