diff --git a/services/clsi/app/coffee/CompileManager.coffee b/services/clsi/app/coffee/CompileManager.coffee index ad924e2b1e..65b78aaff8 100644 --- a/services/clsi/app/coffee/CompileManager.coffee +++ b/services/clsi/app/coffee/CompileManager.coffee @@ -250,7 +250,7 @@ module.exports = CompileManager = directory = getCompileDir(project_id, user_id) timeout = 60 * 1000 # increased to allow for large projects 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? logger.err err:error, command:command, project_id:project_id, user_id:user_id, "error running synctex" return callback(error) diff --git a/services/clsi/app/coffee/LocalCommandRunner.coffee b/services/clsi/app/coffee/LocalCommandRunner.coffee index f47af00177..c5ef3c692c 100644 --- a/services/clsi/app/coffee/LocalCommandRunner.coffee +++ b/services/clsi/app/coffee/LocalCommandRunner.coffee @@ -5,7 +5,7 @@ logger.info "using standard command runner" module.exports = CommandRunner = 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.warn "timeouts and sandboxing are not enabled with CommandRunner" @@ -15,7 +15,11 @@ module.exports = CommandRunner = 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) - 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)-> 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 return callback(err) else - callback() + callback(null, {"stdout": stdout}) return proc.pid # return process id to allow job to be killed if necessary