-
Notifications
You must be signed in to change notification settings - Fork 2
/
fix_node.js
executable file
·69 lines (62 loc) · 2.21 KB
/
fix_node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var cp = require('child_process');
var ev = require('./electron-version.js');
var args = {};
for (var idx = 0; idx < process.argv.length; idx++) {
if (process.argv[idx] && process.argv[idx].match(/^--/) && process.argv[idx].match(/=/)) {
var parts = process.argv[idx].replace(/^--/, '').split(/=/);
args[parts[0]] = parts[1];
}
}
var command = {
add: function (cmd) {
command.commands = command.commands || [];
command.commands.push(cmd);
},
next: function() {
var cmd = command.commands.shift();
if (cmd && cmd.sleep) {
setTimeout(function () {
command.next();
}, cmd.sleep * 1000);
} else if (cmd) {
var opts = {};
if (opts.cwd) { cmd.cwd = opts.cwd; }
var child = cp.exec(cmd.cmd,
function (res) {
console.log("result", res);
command.next();
});
console.log("\nExecuting...");
if (cmd.description) { console.log(cmd.description); }
console.log(cmd.cmd);
child.on('close', function (code) {
console.log("closed with " + code);
command.next();
});
child.stdout.on('data', function (data) {
console.log(data);
})
child.on('error', function (err) {
console.log("spawn failed");
console.log(err);
});
} else {
console.log("all done!");
}
},
begin: function () {
if (command.commands) {
console.log("Let's Begin Now");
command.next();
} else {
console.error("no commands added");
}
}
};
console.log(args);
path = "C:\\Users\\Brian\\.node-gyp\\iojs-" + ev.version;
var cmd = "copy " + path + "\\Release\\node.lib " + path + "\\Release\\iojs.lib /Y";
command.add({ cmd: cmd, description: "fixing node release at " + path });
cmd = "copy " + path + "\\ia32\\iojs.lib " + path + "\\ia32\\node.lib /Y && copy " + path + "\\x64\\iojs.lib " + path + "\\x64\\node.lib /Y";
command.add({ cmd: cmd });
// command.begin();