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
|
Max: 20
|
||||||
|
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 23
|
Max: 25
|
||||||
|
|
||||||
# We don't want to change previous migrations...
|
# We don't want to change previous migrations...
|
||||||
#
|
#
|
||||||
|
@ -110,7 +110,7 @@ class SubmissionsController < ApplicationController
|
|||||||
client_socket = tubesock
|
client_socket = tubesock
|
||||||
|
|
||||||
client_socket.onopen do |_event|
|
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
|
end
|
||||||
|
|
||||||
client_socket.onclose do |_event|
|
client_socket.onclose do |_event|
|
||||||
@ -160,6 +160,9 @@ class SubmissionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
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] = +''
|
@testrun[:output] = +''
|
||||||
durations = @submission.run(@file) do |socket, starting_time|
|
durations = @submission.run(@file) do |socket, starting_time|
|
||||||
runner_socket = socket
|
runner_socket = socket
|
||||||
|
Reference in New Issue
Block a user