mirror of https://github.com/aminya/setup-cpp
Merge pull request #57 from aminya/vcpkg [skip ci]
This commit is contained in:
commit
d35f6780f8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,8 @@ import execa from "execa"
|
|||
import { existsSync } from "fs"
|
||||
import { dirname, join } from "path"
|
||||
import which from "which"
|
||||
import { isRoot } from "../utils/env/sudo"
|
||||
import { execSudo } from "../utils/exec/sudo"
|
||||
import { addShellExtension, addShellHere } from "../utils/extension/extension"
|
||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||
|
@ -29,6 +31,16 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
|||
}
|
||||
|
||||
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" })
|
||||
|
||||
// change the owner to the SUDO_USER in setupDir. vcpkg requires this so it can install things without sudo
|
||||
if (
|
||||
(process.platform === "linux" || process.platform === "darwin") &&
|
||||
isRoot() &&
|
||||
process.env.SUDO_USER !== undefined
|
||||
) {
|
||||
await execSudo("chown", ["-R", process.env.SUDO_USER, setupDir], setupDir)
|
||||
}
|
||||
|
||||
addPath(setupDir)
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
hasVCPKG = true
|
||||
|
|
Loading…
Reference in New Issue