Method: Naf::ApplicationType#invoke

Defined in:
app/models/naf/application_type.rb

#invoke(job, job_command) ⇒ Object

This method calls Process.spawn to excute a built command. The first part of the command is the execution of the job command, redirecting stderr to stdout. Stdout and stderr are then sent through a pipe to be used as input for the job logger. The job logger will also redirect stderr to stdout, and save any crash logs. At the end of the built command, there is a exit $PIPESTATUS command that will return the exit status of the whole command.



42
43
44
45
# File 'app/models/naf/application_type.rb', line 42

def invoke(job, job_command)
  command = job_command + " 2>&1 | #{JOB_LOGGER} >> #{LOGGING_ROOT_DIRECTORY}/naf/crash.log 2>&1; exit $PIPESTATUS"
  Process.spawn({ 'NAF_JOB_ID' => job.id.to_s }, command)
end