fix: fix local execPowershell

This commit is contained in:
Amin Yahyaabadi 2022-02-05 12:41:10 -08:00
parent b7f10afb07
commit c86ba684b1
5 changed files with 5 additions and 5 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,7 @@ function addEnvSystem(name: string, valGiven: string | undefined) {
switch (process.platform) {
case "win32": {
// 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."`)
return
}

View File

@ -18,5 +18,5 @@ export function execPowershell(command: string) {
throw new Error("Could not find powershell")
}
execa.sync(`${powershell} -C "${command}"`)
execa.sync(powershell, ["-c", command])
}

View File

@ -32,7 +32,7 @@ function addPathSystem(path: string) {
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
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.`)
return