fix: add addShellHere to fix sh finding ./file

This commit is contained in:
Amin Yahyaabadi 2021-11-21 12:21:36 -06:00
parent 6b4377de1f
commit 722630db75
4 changed files with 12 additions and 4 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

@ -13,3 +13,11 @@ export function addShellExtension(name: string) {
}
return `${name}.sh`
}
/** Add ./ for unix shell */
export function addShellHere(name: string) {
if (process.platform === "win32") {
return name
}
return `./${name}`
}

View File

@ -3,7 +3,7 @@ import execa from "execa"
import path from "path"
import untildify from "untildify"
import which from "which"
import { addShellExtension } from "../utils/extension/extension"
import { addShellExtension, addShellHere } from "../utils/extension/extension"
import { InstallationInfo } from "../utils/setup/setupBin"
let hasVCPKG = false
@ -13,7 +13,7 @@ export function setupVcpkg(_version: string, _setupCppDir: string, _arch: string
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: untildify("~/") })
const vcpkgDir = untildify("~/vcpkg")
execa.sync(addShellExtension("bootstrap-vcpkg"), { cwd: vcpkgDir, shell: true })
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: vcpkgDir, shell: true })
addPath(vcpkgDir)
hasVCPKG = true
return { binDir: vcpkgDir }