Skip to content

Commit 487a882

Browse files
committed
fix: ignore path modification error for MSVC
1 parent 7092c4b commit 487a882

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/msvc/msvc.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { setupChocoPack } from "../utils/setup/setupChocoPack"
22
import { error } from "@actions/core"
33
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
4-
import { readFileSync } from "fs"
54

65
type MSVCVersion = "2015" | "2017" | "2019" | string
76

@@ -35,9 +34,13 @@ export async function setupMSVC(
3534
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
3635
}
3736
} catch (e) {
38-
error(e as string | Error)
39-
const choco_logs = readFileSync(`${process.env.ALLUSERSPROFILE}\\chocolatey\\logs\\chocolatey.log`, "utf8")
40-
console.log(choco_logs)
37+
if (
38+
!(e as string | Error)
39+
.toString()
40+
.includes("Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH'")
41+
) {
42+
error(e as string | Error)
43+
}
4144
}
4245
// run vcvarsall.bat environment variables
4346
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)

src/vcvarsall/vcvarsall.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { exportVariable } from "@actions/core"
1+
import { exportVariable, info } from "@actions/core"
22
import { existsSync } from "fs"
33

44
function getArch(arch: string): string {
@@ -26,6 +26,7 @@ export function setupVCVarsall(
2626
spectre?: boolean
2727
) {
2828
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
29+
info(`Adding ${VCTargetsPath} to PATH`)
2930
exportVariable("VCTargetsPath", VCTargetsPath)
3031
}
3132

0 commit comments

Comments
 (0)