Fix issue with postprocessing files twice. Fixes #158

dev/git-series/gccdum
Matt Godbolt 7 years ago committed by Matt Godbolt
parent a5b2cedbaa
commit a5c268cbb8

@ -167,7 +167,6 @@ function ClientOptionsHandler(fileSources) {
defaultCompiler: compilerProps('defaultCompiler', ''),
compileOptions: compilerProps("options"),
supportsBinary: !!compilerProps("supportsBinary"),
postProcess: compilerProps("postProcess"),
sources: sources,
raven: gccProps('ravenUrl', ''),
release: gitReleaseName,
@ -342,7 +341,7 @@ function configuredCompilers() {
outputFlag: props("outputFlag", "-o"),
needsMulti: !!props("needsMulti", true),
supportsBinary: !!props("supportsBinary", true),
postProcess: props("postProcess", "")
postProcess: props("postProcess", "").split("|")
});
})).then(_.flatten);
}
@ -356,15 +355,18 @@ function getCompilerInfo(compilerInfo) {
var compiler = compilerInfo.exe;
var versionFlag = compilerInfo.versionFlag || '--version';
// fill field compilerInfo.version,
// assuming the compiler returns it's version on 1 line
// assuming the compiler returns its version on 1 line
child_process.exec('"' + compiler + '" ' + versionFlag, function (err, output) {
if (err) return resolve(null);
if (err) {
console.log("Unable to run compiler '" + compiler + "' : " + err);
return resolve(null);
}
compilerInfo.version = output.split('\n')[0];
if (compilerInfo.intelAsm) {
return resolve(compilerInfo);
}
// get informations on the compiler's options
// get information on the compiler's options
child_process.exec(compiler + ' --target-help', function (err, output) {
var options = {};
if (!err) {

@ -264,8 +264,7 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
var compileToAsmPromise = tempFileAndDirPromise.then(function (info) {
var inputFilename = info.inputFilename;
var dirPath = info.dirPath;
var postProcess = [compilerProps("postProcess"), compilerInfo.postProcess];
postProcess = postProcess.filter(function (x) {
var postProcess = compilerInfo.postProcess.filter(function (x) {
return x;
});
var outputFilename = path.join(dirPath, 'output.s'); // NB keep lower case as ldc compiler `tolower`s the output name
@ -319,7 +318,8 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
}
if (postProcess.length) {
return new Promise(function (resolve) {
child_process.exec('cat "' + outputFilename + '" | ' + postProcess.join(" | "),
var postCommand = 'cat "' + outputFilename + '" | ' + postProcess.join(" | ");
child_process.exec(postCommand,
{maxBuffer: maxSize},
function (err, data) {
if (err)

Loading…
Cancel
Save