Skip to content

Commit 3f97fe8

Browse files
author
jbondc
committed
Wrap all commands in exec()
1 parent dd8ea15 commit 3f97fe8

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

Jakefile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
232232

233233
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
234234
cmd = cmd + sources.join(" ");
235-
console.log(cmd + "\n");
236235

237-
var ex = jake.createExec([cmd], {interactive: true});
238-
ex.addListener("cmdEnd", function() {
236+
exec(cmd, function() {
237+
console.log("")
239238
if (!useDebugMode && prefixes && fs.existsSync(outFile)) {
240239
for (var i in prefixes) {
241240
prependFile(prefixes[i], outFile);
@@ -247,12 +246,11 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
247246
} else {
248247
complete();
249248
}
250-
});
251-
ex.addListener("error", function() {
249+
}, /* errorHandler */ function() {
252250
fs.unlinkSync(outFile);
253251
fail("Compilation of " + outFile + " unsuccessful");
254252
});
255-
ex.run();
253+
256254
}, {async: true});
257255
}
258256

@@ -457,7 +455,7 @@ var refTest262Baseline = path.join(internalTests, "baselines/test262/reference")
457455
desc("Builds the test infrastructure using the built compiler");
458456
task("tests", ["local", run].concat(libraryTargets));
459457

460-
function exec(cmd, completeHandler) {
458+
function exec(cmd, completeHandler, errorHandler) {
461459
console.log(cmd);
462460
var ex = jake.createExec([cmd], {windowsVerbatimArguments: true, interactive: true});
463461
ex.addListener("cmdEnd", function() {
@@ -467,7 +465,7 @@ function exec(cmd, completeHandler) {
467465
complete();
468466
}
469467
});
470-
ex.addListener("error", function(e, status) {
468+
ex.addListener("error", errorHandler ? errorHandler : function(e, status) {
471469
fail("Process exited with code " + status);
472470
})
473471

0 commit comments

Comments
 (0)