Initial open source commit

This commit is contained in:
James Allen
2014-02-12 17:27:43 +00:00
commit c83b03e93f
95 changed files with 16218 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
spawn = require("child_process").spawn
logger = require "logger-sharelatex"
module.exports = CommandRunner =
run: (project_id, command, directory, 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"
proc = spawn command[0], command.slice(1), stdio: "inherit", cwd: directory
proc.on "close", () ->
callback()