Method: Deployed::RunController#cancel

Defined in:
app/controllers/deployed/run_controller.rb

#cancelObject

Endpoint to cancel currently running process



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/deployed/run_controller.rb', line 27

def cancel
  pid = stored_pid
  if process_running?
    # If a process is running, get the PID and attempt to kill it
    begin
      Process.kill('TERM', stored_pid)
    rescue Errno::ESRCH
    ensure
      release_process
    end
  end
  render json: { message: pid }
end