Skip to content

Commit adb5bea

Browse files
joshaberJohn Haley
authored andcommitted
Get the right path for tools.
1 parent 0e78673 commit adb5bea

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lifecycleScripts/install.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ return installPrebuilt();
2626

2727
function installPrebuilt() {
2828
console.info("[nodegit] Fetching binary from S3.");
29-
return exec("node-pre-gyp install --fallback-to-build=false")
29+
var npg = pathForTool("node-pre-gyp");
30+
return exec(npg + " install --fallback-to-build=false")
3031
.then(
3132
function() {
3233
console.info("[nodegit] Completed installation successfully.");
@@ -41,6 +42,13 @@ function installPrebuilt() {
4142
}
4243

4344

45+
function pathForTool(name) {
46+
var toolPath = path.resolve(".", "node_modules", ".bin", name);
47+
toolPath = toolPath.replace(/\s/g, "\\$&");
48+
return toolPath;
49+
}
50+
51+
4452
function prepareAndBuild() {
4553
console.info("[nodegit] Regenerating and configuring code");
4654
return prepareForBuild()
@@ -59,15 +67,13 @@ function build() {
5967
};
6068

6169
var debug = (process.env.BUILD_DEBUG ? " --debug" : "");
62-
var builder = "node-gyp";
6370

6471
var home = process.platform == "win32" ?
6572
process.env.USERPROFILE : process.env.HOME;
6673

6774
opts.env.HOME = path.join(home, ".nodegit-gyp");
6875

69-
builder = path.resolve(".", "node_modules", ".bin", builder);
70-
builder = builder.replace(/\s/g, "\\$&");
76+
var builder = pathForTool("node-gyp");
7177
var cmd = [builder, "rebuild", debug].join(" ").trim();
7278

7379
return exec(cmd, opts)

0 commit comments

Comments
 (0)