Skip to content

Commit 62f16bb

Browse files
committed
msvc-dev-cmv v1.8.1
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.
2 parents 5611a7c + 985d494 commit 62f16bb

File tree

5 files changed

+101
-165
lines changed

5 files changed

+101
-165
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
uses: actions/checkout@v2
1919
- name: Download Internet
2020
run: npm install
21+
- name: Run eslint
22+
run: npm run lint
2123
- name: Enable Developer Command Prompt (amd64)
2224
uses: ./
2325
with:

index.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,27 @@ function main() {
116116
const vcvars = `"${findVcvarsall()}" ${args.join(' ')}`
117117
core.debug(`vcvars command-line: ${vcvars}`)
118118

119-
const old_environment = child_process.execSync(`set`, {shell: "cmd"}).toString().split('\r\n')
120-
const new_environment = child_process.execSync(`${vcvars} && set`, {shell: "cmd"}).toString().split('\r\n')
119+
const cmd_output_string = child_process.execSync(`set && cls && ${vcvars} && cls && set`, {shell: "cmd"}).toString()
120+
const cmd_output_parts = cmd_output_string.split('\f')
121+
122+
const old_environment = cmd_output_parts[0].split('\r\n')
123+
const vcvars_output = cmd_output_parts[1].split('\r\n')
124+
const new_environment = cmd_output_parts[2].split('\r\n')
121125

122126
// If vsvars.bat is given an incorrect command line, it will print out
123127
// an error and *still* exit successfully. Parse out errors from output
124128
// which don't look like environment variables, and fail if appropriate.
125-
var failed = false
126-
for (let line of new_environment) {
129+
const error_messages = vcvars_output.filter((line) => {
127130
if (line.match(/^\[ERROR.*\]/)) {
128-
failed = true
129131
// Don't print this particular line which will be confusing in output.
130-
if (line.match(/Error in script usage. The correct usage is:$/)) {
131-
continue
132+
if (!line.match(/Error in script usage. The correct usage is:$/)) {
133+
return true
132134
}
133-
core.error(line)
134135
}
135-
}
136-
if (failed) {
137-
throw new Error('invalid parameters')
136+
return false
137+
})
138+
if (error_messages.length > 0) {
139+
throw new Error('invalid parameters' + '\r\n' + error_messages.join('\r\n'))
138140
}
139141

140142
// Convert old environment lines into a dictionary for easier lookup.

node_modules/.package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)