Properly cancel code execution if running is prohibited

This commit is contained in:
Sebastian Serth
2023-02-16 23:56:19 +01:00
committed by Sebastian Serth
parent e632f95060
commit a1ec4579fe
2 changed files with 5 additions and 2 deletions

View File

@ -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