fix CompileManager and LocalCommandRunner
This commit is contained in:
@@ -250,7 +250,7 @@ module.exports = CompileManager =
|
|||||||
directory = getCompileDir(project_id, user_id)
|
directory = getCompileDir(project_id, user_id)
|
||||||
timeout = 60 * 1000 # increased to allow for large projects
|
timeout = 60 * 1000 # increased to allow for large projects
|
||||||
compileName = getCompileName(project_id, user_id)
|
compileName = getCompileName(project_id, user_id)
|
||||||
CommandRunner.run compileName, command, directory, Settings.clsi.docker.image, timeout, {}, (error, output) ->
|
CommandRunner.run compileName, command, directory, Settings.clsi?.docker.image, timeout, {}, (error, output) ->
|
||||||
if error?
|
if error?
|
||||||
logger.err err:error, command:command, project_id:project_id, user_id:user_id, "error running synctex"
|
logger.err err:error, command:command, project_id:project_id, user_id:user_id, "error running synctex"
|
||||||
return callback(error)
|
return callback(error)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ logger.info "using standard command runner"
|
|||||||
|
|
||||||
module.exports = CommandRunner =
|
module.exports = CommandRunner =
|
||||||
run: (project_id, command, directory, image, timeout, environment, callback = (error) ->) ->
|
run: (project_id, command, directory, image, timeout, environment, callback = (error) ->) ->
|
||||||
command = (arg.replace('$COMPILE_DIR', directory) for arg in command)
|
command = (arg.toString().replace('$COMPILE_DIR', directory) for arg in command)
|
||||||
logger.log project_id: project_id, command: command, directory: directory, "running command"
|
logger.log project_id: project_id, command: command, directory: directory, "running command"
|
||||||
logger.warn "timeouts and sandboxing are not enabled with CommandRunner"
|
logger.warn "timeouts and sandboxing are not enabled with CommandRunner"
|
||||||
|
|
||||||
@@ -15,7 +15,11 @@ module.exports = CommandRunner =
|
|||||||
env[key] = value for key, value of environment
|
env[key] = value for key, value of environment
|
||||||
|
|
||||||
# run command as detached process so it has its own process group (which can be killed if needed)
|
# run command as detached process so it has its own process group (which can be killed if needed)
|
||||||
proc = spawn command[0], command.slice(1), stdio: "inherit", cwd: directory, detached: true, env: env
|
proc = spawn command[0], command.slice(1), cwd: directory, env: env
|
||||||
|
|
||||||
|
stdout = ""
|
||||||
|
proc.stdout.on "data", (data)->
|
||||||
|
stdout += data
|
||||||
|
|
||||||
proc.on "error", (err)->
|
proc.on "error", (err)->
|
||||||
logger.err err:err, project_id:project_id, command: command, directory: directory, "error running command"
|
logger.err err:err, project_id:project_id, command: command, directory: directory, "error running command"
|
||||||
@@ -32,7 +36,7 @@ module.exports = CommandRunner =
|
|||||||
err.code = code
|
err.code = code
|
||||||
return callback(err)
|
return callback(err)
|
||||||
else
|
else
|
||||||
callback()
|
callback(null, {"stdout": stdout})
|
||||||
|
|
||||||
return proc.pid # return process id to allow job to be killed if necessary
|
return proc.pid # return process id to allow job to be killed if necessary
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user