CommandRunner.coffee 543 B

123456789101112
  1. spawn = require("child_process").spawn
  2. logger = require "logger-sharelatex"
  3. module.exports = CommandRunner =
  4. run: (project_id, command, directory, timeout, callback = (error) ->) ->
  5. command = (arg.replace('$COMPILE_DIR', directory) for arg in command)
  6. logger.log project_id: project_id, command: command, directory: directory, "running command"
  7. logger.warn "timeouts and sandboxing are not enabled with CommandRunner"
  8. proc = spawn command[0], command.slice(1), stdio: "inherit", cwd: directory
  9. proc.on "close", () ->
  10. callback()