Skip to content

Commit

Permalink
Merge pull request #57 from aminya/vcpkg [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Apr 25, 2022
2 parents 9b3e93e + 7949188 commit d35f678
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/vcpkg/vcpkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit d35f678

Please sign in to comment.