Просмотр исходного кода

run chktex when request has check:true

Brian Gough 10 лет назад
Родитель
Сommit
d6d6e18b89

+ 4 - 0
services/clsi/app/coffee/CommandRunner.coffee

@@ -27,6 +27,10 @@ module.exports = CommandRunner =
 				err = new Error("terminated")
 				err.terminated = true
 				return callback(err)
+			else if code
+				err = new Error("exit")
+				err.code = code
+				return callback(err)
 			else
 				callback()
 

+ 2 - 0
services/clsi/app/coffee/CompileController.coffee

@@ -17,6 +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?
 						logger.error err: error, project_id: request.project_id, "error running compile"
 						if error.timedout

+ 4 - 4
services/clsi/app/coffee/CompileManager.coffee

@@ -44,9 +44,9 @@ module.exports = CompileManager =
 
 			# set up environment variables for chktex
 			env = {}
-			if request.chktex?
-				env['CHKTEX_OPTIONS'] =  '-nall -e9 -e10 -e15 -e16 -e27'
-				if request.chktex is 'error'
+			if request.check?
+				env['CHKTEX_OPTIONS'] =  '-nall -e9 -e10 -w15 -w16 -w27'
+				if request.check is 'error'
 					env['CHKTEX_EXIT_ON_ERROR'] =  1
 
 			injectDraftModeIfRequired (error) ->
@@ -67,7 +67,7 @@ module.exports = CompileManager =
 					environment: env
 				}, (error, output, stats, timings) ->
 					# compile was killed by user
-					if error?.terminated
+					if error?.terminated or error?.code is 1
 						OutputFileFinder.findOutputFiles request.resources, compileDir, (err, outputFiles) ->
 							return callback(err) if err?
 							callback(error, outputFiles) # return output files so user can check logs

+ 3 - 0
services/clsi/app/coffee/RequestParser.coffee

@@ -28,6 +28,9 @@ module.exports = RequestParser =
 				compile.options.draft,
 				default: false,
 				type: "boolean"
+			response.check = @_parseAttribute "check",
+				compile.options.check,
+				type: "string"
 
 			if response.timeout > RequestParser.MAX_TIMEOUT
 				response.timeout = RequestParser.MAX_TIMEOUT