|
|
|
@ -88,7 +88,7 @@ Compile.prototype.runCompiler = function (compiler, options) {
|
|
|
|
|
stderr += data;
|
|
|
|
|
});
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
|
child.on('error', function(e) {
|
|
|
|
|
child.on('error', function (e) {
|
|
|
|
|
reject(e);
|
|
|
|
|
});
|
|
|
|
|
child.on('exit', function (code) {
|
|
|
|
@ -120,7 +120,7 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
|
|
|
|
|
}
|
|
|
|
|
self.cacheMisses++;
|
|
|
|
|
|
|
|
|
|
var tempFileAndDirPromise = self.compileQueue.add(function () {
|
|
|
|
|
var tempFileAndDirPromise = Promise.resolve().then(function () {
|
|
|
|
|
return self.newTempDir().then(function (dirPath) {
|
|
|
|
|
var inputFilename = path.join(dirPath, props.get("gcc-explorer", "compileFilename"));
|
|
|
|
|
return self.writeFile(inputFilename, source).then(function () {
|
|
|
|
@ -176,16 +176,18 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return compileToAsmPromise.then(function (result) {
|
|
|
|
|
if (result.dirPath) {
|
|
|
|
|
fs.remove(result.dirPath);
|
|
|
|
|
result.dirPath = undefined;
|
|
|
|
|
}
|
|
|
|
|
if (result.okToCache) {
|
|
|
|
|
self.cache.set(key, result);
|
|
|
|
|
self.cacheStats();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
return self.compileQueue.add(function () {
|
|
|
|
|
return compileToAsmPromise.then(function (result) {
|
|
|
|
|
if (result.dirPath) {
|
|
|
|
|
fs.remove(result.dirPath);
|
|
|
|
|
result.dirPath = undefined;
|
|
|
|
|
}
|
|
|
|
|
if (result.okToCache) {
|
|
|
|
|
self.cache.set(key, result);
|
|
|
|
|
self.cacheStats();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|