mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
more progress with the lexer, perhaps it's done
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
};
|
||||
// Compile a list of CoffeeScript files on disk.
|
||||
exports.compile_files = function compile_files(paths, callback) {
|
||||
var coffee, js;
|
||||
var coffee, exit_ran, js;
|
||||
js = '';
|
||||
coffee = process.createChildProcess(compiler, ['--print'].concat(paths));
|
||||
coffee.addListener('output', function(results) {
|
||||
@@ -31,7 +31,13 @@
|
||||
return js += results;
|
||||
}
|
||||
});
|
||||
// NB: we have to add a mutex to make sure it doesn't get called twice.
|
||||
exit_ran = false;
|
||||
return coffee.addListener('exit', function() {
|
||||
if (exit_ran) {
|
||||
return null;
|
||||
}
|
||||
exit_ran = true;
|
||||
return callback(js);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user