capture texcount error output
This commit is contained in:
@@ -226,7 +226,7 @@ module.exports = CompileManager =
|
|||||||
wordcount: (project_id, user_id, file_name, image, callback = (error, pdfPositions) ->) ->
|
wordcount: (project_id, user_id, file_name, image, callback = (error, pdfPositions) ->) ->
|
||||||
logger.log project_id:project_id, user_id:user_id, file_name:file_name, image:image, "running wordcount"
|
logger.log project_id:project_id, user_id:user_id, file_name:file_name, image:image, "running wordcount"
|
||||||
file_path = "$COMPILE_DIR/" + file_name
|
file_path = "$COMPILE_DIR/" + file_name
|
||||||
command = [ "texcount", '-inc', file_path, "-out=" + file_path + ".wc"]
|
command = [ "texcount", '-nocol', '-inc', file_path, "-out=" + file_path + ".wc"]
|
||||||
directory = getCompileDir(project_id, user_id)
|
directory = getCompileDir(project_id, user_id)
|
||||||
timeout = 10 * 1000
|
timeout = 10 * 1000
|
||||||
compileName = getCompileName(project_id, user_id)
|
compileName = getCompileName(project_id, user_id)
|
||||||
@@ -237,7 +237,9 @@ module.exports = CompileManager =
|
|||||||
if err?
|
if err?
|
||||||
logger.err err:err, command:command, directory:directory, project_id:project_id, user_id:user_id, "error reading word count output"
|
logger.err err:err, command:command, directory:directory, project_id:project_id, user_id:user_id, "error reading word count output"
|
||||||
return callback(err)
|
return callback(err)
|
||||||
callback null, CompileManager._parseWordcountFromOutput(stdout)
|
results = CompileManager._parseWordcountFromOutput(stdout)
|
||||||
|
logger.log project_id:project_id, user_id:user_id, wordcount: results, "word count results"
|
||||||
|
callback null, results
|
||||||
|
|
||||||
_parseWordcountFromOutput: (output) ->
|
_parseWordcountFromOutput: (output) ->
|
||||||
results = {
|
results = {
|
||||||
@@ -249,6 +251,8 @@ module.exports = CompileManager =
|
|||||||
elements: 0
|
elements: 0
|
||||||
mathInline: 0
|
mathInline: 0
|
||||||
mathDisplay: 0
|
mathDisplay: 0
|
||||||
|
errors: 0
|
||||||
|
messages: ""
|
||||||
}
|
}
|
||||||
for line in output.split("\n")
|
for line in output.split("\n")
|
||||||
[data, info] = line.split(":")
|
[data, info] = line.split(":")
|
||||||
@@ -268,4 +272,8 @@ module.exports = CompileManager =
|
|||||||
results['mathInline'] = parseInt(info, 10)
|
results['mathInline'] = parseInt(info, 10)
|
||||||
if data.indexOf("Number of math displayed") > -1
|
if data.indexOf("Number of math displayed") > -1
|
||||||
results['mathDisplay'] = parseInt(info, 10)
|
results['mathDisplay'] = parseInt(info, 10)
|
||||||
|
if data is "(errors" # errors reported as (errors:123)
|
||||||
|
results['errors'] = parseInt(info, 10)
|
||||||
|
if line.indexOf("!!! ") > -1 # errors logged as !!! message !!!
|
||||||
|
results['messages'] += line + "\n"
|
||||||
return results
|
return results
|
||||||
|
|||||||
Reference in New Issue
Block a user