mirror of https://github.com/aminya/setup-cpp
fix: use appendFileSync instead of echo >>
This commit is contained in:
parent
f13a48fae9
commit
8e542b0dc8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue