fix: untildify the profile path

This commit is contained in:
Amin Yahyaabadi 2022-01-17 14:31:50 -08:00
parent c0e8c96665
commit f13a48fae9
4 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,7 @@
"nothrow", "nothrow",
"Opencppcoverage", "Opencppcoverage",
"OSSDK", "OSSDK",
"setx",
"untildify", "untildify",
"vcpkg", "vcpkg",
"visualc", "visualc",

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

@ -3,6 +3,7 @@ import { delimiter } from "path"
import * as core from "@actions/core" import * as core from "@actions/core"
import execa from "execa" import execa from "execa"
import { isGitHubCI } from "../env/isci" import { isGitHubCI } from "../env/isci"
import untildify from "untildify"
/** An add path function that works locally or inside GitHub Actions */ /** An add path function that works locally or inside GitHub Actions */
export function addPath(path: string) { export function addPath(path: string) {
@ -31,9 +32,10 @@ function addPathSystem(path: string) {
} }
case "linux": case "linux":
case "darwin": { case "darwin": {
execa.commandSync(`echo "export PATH=${path}:$PATH" >> ~/.profile`) const profile_path = untildify("~/.profile")
execa.commandSync(`source ~/.profile`) execa.commandSync(`echo "export PATH=${path}:$PATH" >> "${profile_path}"`)
core.info(`${path} was added to ~/.profile`) execa.commandSync(`source "${profile_path}"`)
core.info(`${path} was added to "${profile_path}"`)
return return
} }
default: { default: {