fix: use appendFileSync instead of echo >>

This commit is contained in:
Amin Yahyaabadi 2022-01-17 14:36:44 -08:00
parent f13a48fae9
commit 8e542b0dc8
3 changed files with 4 additions and 3 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

@ -4,6 +4,7 @@ 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" import untildify from "untildify"
import { appendFileSync } from "fs"
/** 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) {
@ -33,7 +34,7 @@ function addPathSystem(path: string) {
case "linux": case "linux":
case "darwin": { case "darwin": {
const profile_path = untildify("~/.profile") const profile_path = untildify("~/.profile")
execa.commandSync(`echo "export PATH=${path}:$PATH" >> "${profile_path}"`) appendFileSync(profile_path, `\nexport PATH=${path}:$PATH\n`)
execa.commandSync(`source "${profile_path}"`) execa.commandSync(`source "${profile_path}"`)
core.info(`${path} was added to "${profile_path}"`) core.info(`${path} was added to "${profile_path}"`)
return return