Allow optional image name to be passed
This commit is contained in:
@@ -2,7 +2,7 @@ spawn = require("child_process").spawn
|
||||
logger = require "logger-sharelatex"
|
||||
|
||||
module.exports = CommandRunner =
|
||||
run: (project_id, command, directory, timeout, callback = (error) ->) ->
|
||||
run: (project_id, command, directory, image, timeout, callback = (error) ->) ->
|
||||
command = (arg.replace('$COMPILE_DIR', directory) for arg in command)
|
||||
logger.log project_id: project_id, command: command, directory: directory, "running command"
|
||||
logger.warn "timeouts and sandboxing are not enabled with CommandRunner"
|
||||
|
||||
@@ -28,6 +28,7 @@ module.exports = CompileManager =
|
||||
mainFile: request.rootResourcePath
|
||||
compiler: request.compiler
|
||||
timeout: request.timeout
|
||||
image: request.imageName
|
||||
}, (error) ->
|
||||
return callback(error) if error?
|
||||
logger.log project_id: request.project_id, time_taken: Date.now() - timer.start, "done compile"
|
||||
|
||||
@@ -6,7 +6,7 @@ CommandRunner = require(Settings.clsi?.commandRunner or "./CommandRunner")
|
||||
|
||||
module.exports = LatexRunner =
|
||||
runLatex: (project_id, options, callback = (error) ->) ->
|
||||
{directory, mainFile, compiler, timeout} = options
|
||||
{directory, mainFile, compiler, timeout, image} = options
|
||||
compiler ||= "pdflatex"
|
||||
timeout ||= 60000 # milliseconds
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = LatexRunner =
|
||||
else
|
||||
return callback new Error("unknown compiler: #{compiler}")
|
||||
|
||||
CommandRunner.run project_id, command, directory, timeout, callback
|
||||
CommandRunner.run project_id, command, directory, image, timeout, callback
|
||||
|
||||
_latexmkBaseCommand: [ "latexmk", "-cd", "-f", "-jobname=output", "-auxdir=$COMPILE_DIR", "-outdir=$COMPILE_DIR"]
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ module.exports = RequestParser =
|
||||
compile.options.timeout
|
||||
default: RequestParser.MAX_TIMEOUT
|
||||
type: "number"
|
||||
response.imageName = @_parseAttribute "imageName",
|
||||
compile.options.imageName,
|
||||
type: "string"
|
||||
|
||||
if response.timeout > RequestParser.MAX_TIMEOUT
|
||||
response.timeout = RequestParser.MAX_TIMEOUT
|
||||
@@ -71,7 +74,6 @@ module.exports = RequestParser =
|
||||
throw "#{name} attribute should be a #{options.type}"
|
||||
else
|
||||
return options.default if options.default?
|
||||
throw "Default not implemented"
|
||||
return attribute
|
||||
|
||||
_sanitizePath: (path) ->
|
||||
|
||||
Reference in New Issue
Block a user