Skip to content

Commit

Permalink
msvc-dev-cmv v1.8.1
Browse files Browse the repository at this point in the history
Also updating and adding whatever the new version of npm wants to be
updated and added in its package files. This should not affect the
behavior of the action.
  • Loading branch information
ilammy committed May 26, 2021
2 parents 5611a7c + 985d494 commit 62f16bb
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 165 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
uses: actions/checkout@v2
- name: Download Internet
run: npm install
- name: Run eslint
run: npm run lint
- name: Enable Developer Command Prompt (amd64)
uses: ./
with:
Expand Down
24 changes: 13 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,27 @@ function main() {
const vcvars = `"${findVcvarsall()}" ${args.join(' ')}`
core.debug(`vcvars command-line: ${vcvars}`)

const old_environment = child_process.execSync(`set`, {shell: "cmd"}).toString().split('\r\n')
const new_environment = child_process.execSync(`${vcvars} && set`, {shell: "cmd"}).toString().split('\r\n')
const cmd_output_string = child_process.execSync(`set && cls && ${vcvars} && cls && set`, {shell: "cmd"}).toString()
const cmd_output_parts = cmd_output_string.split('\f')

const old_environment = cmd_output_parts[0].split('\r\n')
const vcvars_output = cmd_output_parts[1].split('\r\n')
const new_environment = cmd_output_parts[2].split('\r\n')

// If vsvars.bat is given an incorrect command line, it will print out
// an error and *still* exit successfully. Parse out errors from output
// which don't look like environment variables, and fail if appropriate.
var failed = false
for (let line of new_environment) {
const error_messages = vcvars_output.filter((line) => {
if (line.match(/^\[ERROR.*\]/)) {
failed = true
// Don't print this particular line which will be confusing in output.
if (line.match(/Error in script usage. The correct usage is:$/)) {
continue
if (!line.match(/Error in script usage. The correct usage is:$/)) {
return true
}
core.error(line)
}
}
if (failed) {
throw new Error('invalid parameters')
return false
})
if (error_messages.length > 0) {
throw new Error('invalid parameters' + '\r\n' + error_messages.join('\r\n'))
}

// Convert old environment lines into a dictionary for easier lookup.
Expand Down
13 changes: 13 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 62f16bb

Please sign in to comment.