fix: make cpprc editable by the user

This commit is contained in:
Amin Yahyaabadi 2022-11-20 21:19:18 -08:00
parent f9582b64f0
commit ded42d5c2f
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import { error, warning } from "ci-log"
import { execPowershell } from "exec-powershell" import { execPowershell } from "exec-powershell"
import { delimiter } from "path" import { delimiter } from "path"
import escapeSpace from "escape-path-with-spaces" import escapeSpace from "escape-path-with-spaces"
import { giveUserAccess } from "user-access"
/** /**
* Add an environment variable. * Add an environment variable.
@ -125,6 +126,10 @@ export function setupCppInProfile() {
appendFileSync(cpprc_path, `\n${source_cpprc_str}\n`) appendFileSync(cpprc_path, `\n${source_cpprc_str}\n`)
info(`Added ${source_cpprc_str} to ${cpprc_path}`) info(`Added ${source_cpprc_str} to ${cpprc_path}`)
giveUserAccess(cpprc_path)
// source cpprc in bashrc/profile
const source_cpprc_string = `\n# source .cpprc if SOURCE_CPPRC is not set to 0\nif [[ "$SOURCE_CPPRC" != 0 && -f "${cpprc_path}" ]]; then source "${cpprc_path}"; fi\n` const source_cpprc_string = `\n# source .cpprc if SOURCE_CPPRC is not set to 0\nif [[ "$SOURCE_CPPRC" != 0 && -f "${cpprc_path}" ]]; then source "${cpprc_path}"; fi\n`
try { try {