read wordcount output asynchronously

This commit is contained in:
Brian Gough 2016-08-11 09:32:47 +01:00
parent 872dbc5215
commit 400590b3ad

View file

@ -233,12 +233,11 @@ module.exports = CompileManager =
CommandRunner.run compileName, command, directory, image, timeout, {}, (error) -> CommandRunner.run compileName, command, directory, image, timeout, {}, (error) ->
return callback(error) if error? return callback(error) if error?
try fs.readFile directory + "/" + file_name + ".wc", "utf-8", (err, stdout) ->
stdout = fs.readFileSync(directory + "/" + file_name + ".wc", "utf-8") if err?
catch 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)
callback null, CompileManager._parseWordcountFromOutput(stdout)
_parseWordcountFromOutput: (output) -> _parseWordcountFromOutput: (output) ->
results = { results = {