From f16c7bb7f3c774764e42dc3d97504b45f9c0e514 Mon Sep 17 00:00:00 2001 From: Partouf Date: Thu, 15 Mar 2018 18:30:31 +0100 Subject: refactor to add extra test --- lib/compilers/pascal.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/compilers/pascal.js') diff --git a/lib/compilers/pascal.js b/lib/compilers/pascal.js index f67cfba6c..182ca2a9d 100644 --- a/lib/compilers/pascal.js +++ b/lib/compilers/pascal.js @@ -129,14 +129,18 @@ class FPCCompiler extends BaseCompiler { options.push(projectFile); return this.exec(compiler, options, execOptions).then(result => { - const fileWithoutPath = path.basename(inputFilename); - result.inputFilename = fileWithoutPath; - result.stdout = utils.parseOutput(result.stdout, fileWithoutPath, tempPath); - result.stderr = utils.parseOutput(result.stderr, fileWithoutPath, tempPath); - return result; + return this.parseOutput(result, inputFilename, tempPath); }); } + parseOutput(result, inputFilename, tempPath) { + const fileWithoutPath = path.basename(inputFilename); + result.inputFilename = fileWithoutPath; + result.stdout = utils.parseOutput(result.stdout, fileWithoutPath, tempPath); + result.stderr = utils.parseOutput(result.stderr, fileWithoutPath, tempPath); + return result; + } + execBinary(executable, result, maxSize) { executable = path.join(path.dirname(executable), "prog"); -- cgit v1.2.3