mirror of https://github.com/aminya/setup-cpp
fix: unset Path, TMP, and TEMP before MSVC installations
This commit is contained in:
parent
3b5817d13d
commit
1042fffd1a
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -43,7 +43,7 @@ dependencies:
|
||||||
execa: 5.1.1
|
execa: 5.1.1
|
||||||
hasha: 5.2.2
|
hasha: 5.2.2
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/dba5a20a9276e1a268337d014d486be27b98d66a
|
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/5f5bfe1350e719f8dd9634cb2dc945e808e65327
|
||||||
semver: 7.3.5
|
semver: 7.3.5
|
||||||
setup-python: github.com/actions/setup-python/f38219332975fe8f9c04cca981d674bf22aea1d3
|
setup-python: github.com/actions/setup-python/f38219332975fe8f9c04cca981d674bf22aea1d3
|
||||||
untildify: 4.0.0
|
untildify: 4.0.0
|
||||||
|
@ -8619,8 +8619,8 @@ packages:
|
||||||
semver: 7.3.5
|
semver: 7.3.5
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
github.com/aminya/msvc-dev-cmd/dba5a20a9276e1a268337d014d486be27b98d66a:
|
github.com/aminya/msvc-dev-cmd/5f5bfe1350e719f8dd9634cb2dc945e808e65327:
|
||||||
resolution: {tarball: https://codeload.github.com/aminya/msvc-dev-cmd/tar.gz/dba5a20a9276e1a268337d014d486be27b98d66a}
|
resolution: {tarball: https://codeload.github.com/aminya/msvc-dev-cmd/tar.gz/5f5bfe1350e719f8dd9634cb2dc945e808e65327}
|
||||||
name: msvc-dev-cmd
|
name: msvc-dev-cmd
|
||||||
version: 1.1.1
|
version: 1.1.1
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -22,7 +22,6 @@ export async function setupMSVC(
|
||||||
|
|
||||||
let toolset: string | undefined
|
let toolset: string | undefined
|
||||||
let VCTargetsPath: string | undefined
|
let VCTargetsPath: string | undefined
|
||||||
// TODO enable this code path once its bugs are fixed
|
|
||||||
// https://github.com/aminya/setup-cpp/issues/1
|
// https://github.com/aminya/setup-cpp/issues/1
|
||||||
try {
|
try {
|
||||||
if (version === "14.0") {
|
if (version === "14.0") {
|
||||||
|
@ -41,14 +40,8 @@ export async function setupMSVC(
|
||||||
error(`The given MSVC versions ${versionGiven} is not supported yet.`)
|
error(`The given MSVC versions ${versionGiven} is not supported yet.`)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
|
||||||
!(e as string | Error)
|
|
||||||
.toString()
|
|
||||||
.includes("Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH'")
|
|
||||||
) {
|
|
||||||
error(e as string | Error)
|
error(e as string | Error)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// run vcvarsall.bat environment variables
|
// run vcvarsall.bat environment variables
|
||||||
setupVCVarsall(version, VCTargetsPath, arch, toolset, sdk, uwp, spectre)
|
setupVCVarsall(version, VCTargetsPath, arch, toolset, sdk, uwp, spectre)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,18 @@ export async function setupChocoPack(name: string, version?: string, args: strin
|
||||||
hasChoco = true
|
hasChoco = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/jberezanski/ChocolateyPackages/issues/97#issuecomment-986825694
|
||||||
|
const PATH = process.env.PATH
|
||||||
|
const env = { ...process.env }
|
||||||
|
delete env.TMP
|
||||||
|
delete env.TEMP
|
||||||
|
delete env.Path
|
||||||
|
env.PATH = PATH
|
||||||
|
|
||||||
if (version !== undefined && version !== "") {
|
if (version !== undefined && version !== "") {
|
||||||
execa.sync("choco", ["install", "-y", name, `--version=${version}`, ...args])
|
execa.sync("choco", ["install", "-y", name, `--version=${version}`, ...args], { env, extendEnv: false })
|
||||||
} else {
|
} else {
|
||||||
execa.sync("choco", ["install", "-y", name, ...args])
|
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
const binDir = "C:/ProgramData/Chocolatey/bin/"
|
const binDir = "C:/ProgramData/Chocolatey/bin/"
|
||||||
|
|
Loading…
Reference in New Issue