mirror of https://github.com/aminya/setup-cpp
fix: fix local execPowershell
This commit is contained in:
parent
b7f10afb07
commit
c86ba684b1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,7 @@ function addEnvSystem(name: string, valGiven: string | undefined) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit
|
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit
|
||||||
execPowershell(`[Environment]::SetEnvironmentVariable('${name}', '${val}', 'User')`)
|
execPowershell(`[Environment]::SetEnvironmentVariable("${name}", "${val}", "User")`)
|
||||||
core.info(`${name}="${val} was set in the environment."`)
|
core.info(`${name}="${val} was set in the environment."`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,5 @@ export function execPowershell(command: string) {
|
||||||
throw new Error("Could not find powershell")
|
throw new Error("Could not find powershell")
|
||||||
}
|
}
|
||||||
|
|
||||||
execa.sync(`${powershell} -C "${command}"`)
|
execa.sync(powershell, ["-c", command])
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ function addPathSystem(path: string) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
||||||
execPowershell(
|
execPowershell(
|
||||||
`$USER_PATH=[Environment]::GetEnvironmentVariable('PATH', 'User'); [Environment]::SetEnvironmentVariable('PATH', \\"${path};$USER_PATH\\", 'User')`
|
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
||||||
)
|
)
|
||||||
core.info(`${path} was added to the PATH.`)
|
core.info(`${path} was added to the PATH.`)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue