Correctly handle async calls; fix formatting

This commit is contained in:
Ryan Cavanaugh 2014-09-02 14:22:14 -07:00
parent 18de560402
commit 7ae6739ff1

View File

@ -313,9 +313,9 @@ function exec(cmd, completeHandler) {
complete();
});
ex.addListener("error", function(e, status) {
process.stderr.write(status);
process.stderr.write(e);
complete();
process.stderr.write(status);
process.stderr.write(e);
complete();
})
try{
ex.run();
@ -378,9 +378,9 @@ task("runtests", ["tests", builtLocalDirectory], function() {
desc("Generates code coverage data via instanbul")
task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
console.log(cmd);
exec(cmd);
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
console.log(cmd);
exec(cmd);
}, { async: true });
// Browser tests
@ -465,7 +465,7 @@ compileFile(webhostJsPath, [webhostPath], [tscFile, webhostPath].concat(libraryT
desc("Builds the tsc web host");
task("webhost", [webhostJsPath], function() {
jake.cpR(path.join(builtLocalDirectory, "lib.d.ts"), "tests/webhost/", {silent: true});
jake.cpR(path.join(builtLocalDirectory, "lib.d.ts"), "tests/webhost/", {silent: true});
});
// Perf compiler
@ -478,16 +478,17 @@ task("perftsc", [perftscJsPath]);
// Instrumented compiler
var loggedIOpath = harnessDirectory + 'loggedIO.ts';
var loggedIOJsPath = builtLocalDirectory + 'loggedIO.js';
file(loggedIOJsPath, [builtLocalDirectory], function() {
var temp = builtLocalDirectory + 'temp';
file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function() {
var temp = builtLocalDirectory + 'temp';
jake.mkdirP(temp);
var options = "--outdir " + temp + ' ' + loggedIOpath;
var cmd = host + " " + LKGDirectory + compilerFilename + " " + options + " ";
console.log(cmd + "\n");
var ex = jake.createExec([cmd]);
ex.addListener("cmdEnd", function() {
fs.renameSync(temp + '/harness/loggedIO.js', loggedIOJsPath);
jake.rmRf(temp);
fs.renameSync(temp + '/harness/loggedIO.js', loggedIOJsPath);
jake.rmRf(temp);
complete();
});
ex.run();
}, {async: true});
@ -498,12 +499,11 @@ compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath],
desc("Builds an instrumented tsc.js");
task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function() {
var cmd = host + ' ' + instrumenterJsPath + ' record iocapture ' + builtLocalDirectory + compilerFilename;
console.log(cmd);
var cmd = host + ' ' + instrumenterJsPath + ' record iocapture ' + builtLocalDirectory + compilerFilename;
console.log(cmd);
var ex = jake.createExec([cmd]);
ex.addListener("error", function(e) {
console.log('error running instrumenter');
console.log(e);
ex.addListener("cmdEnd", function() {
complete();
});
ex.run();
}, { async: true });
ex.run();
}, { async: true });