From 664e908378389f1e12f30e274084a9aa99435c81 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 27 Jul 2016 16:54:27 +0100 Subject: [PATCH] provide validation mode where compilation always exits after chktex --- app/coffee/CompileController.coffee | 4 ++-- app/coffee/CompileManager.coffee | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/coffee/CompileController.coffee b/app/coffee/CompileController.coffee index 3c9af67..56237bf 100644 --- a/app/coffee/CompileController.coffee +++ b/app/coffee/CompileController.coffee @@ -17,8 +17,8 @@ module.exports = CompileController = CompileManager.doCompile request, (error, outputFiles = []) -> if error?.terminated status = "terminated" - else if error?.code is 1 - status = "exited" + else if error?.validate + status = "validation-#{error.validate}" else if error? logger.error err: error, project_id: request.project_id, "error running compile" if error.timedout diff --git a/app/coffee/CompileManager.coffee b/app/coffee/CompileManager.coffee index 3b19cec..4c89a0b 100644 --- a/app/coffee/CompileManager.coffee +++ b/app/coffee/CompileManager.coffee @@ -48,6 +48,8 @@ module.exports = CompileManager = env['CHKTEX_OPTIONS'] = '-nall -e9 -e10 -w15 -w16 -w27' if request.check is 'error' env['CHKTEX_EXIT_ON_ERROR'] = 1 + if request.check is 'validate' + env['CHKTEX_VALIDATE'] = 1 injectDraftModeIfRequired (error) -> return callback(error) if error? @@ -66,8 +68,12 @@ module.exports = CompileManager = image: request.imageName environment: env }, (error, output, stats, timings) -> + if request.check is "validate" + result = if error?.code then "fail" else "pass" + error = new Error("validation") + error.validate = result # compile was killed by user - if error?.terminated or error?.code is 1 + if error?.terminated or error?.validate OutputFileFinder.findOutputFiles request.resources, compileDir, (err, outputFiles) -> return callback(err) if err? callback(error, outputFiles) # return output files so user can check logs