Properly cancel code execution if running is prohibited
This commit is contained in:

committed by
Sebastian Serth

parent
e632f95060
commit
a1ec4579fe
@ -20,7 +20,7 @@ Metrics/CyclomaticComplexity:
|
||||
Max: 20
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 23
|
||||
Max: 25
|
||||
|
||||
# We don't want to change previous migrations...
|
||||
#
|
||||
|
@ -110,7 +110,7 @@ class SubmissionsController < ApplicationController
|
||||
client_socket = tubesock
|
||||
|
||||
client_socket.onopen do |_event|
|
||||
return kill_client_socket(client_socket) if @embed_options[:disable_run]
|
||||
kill_client_socket(client_socket) and return true if @embed_options[:disable_run]
|
||||
end
|
||||
|
||||
client_socket.onclose do |_event|
|
||||
@ -160,6 +160,9 @@ class SubmissionsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# If running is not allowed (and the socket is closed), we can stop here.
|
||||
return true if @embed_options[:disable_run]
|
||||
|
||||
@testrun[:output] = +''
|
||||
durations = @submission.run(@file) do |socket, starting_time|
|
||||
runner_socket = socket
|
||||
|
Reference in New Issue
Block a user