Handle broken pipe socket in SubmissionsController

Fixes CODEOCEAN-Y2
This commit is contained in:
Sebastian Serth
2023-11-06 00:16:53 +01:00
parent 2872c04934
commit 920f2dcb38

View File

@ -348,6 +348,9 @@ class SubmissionsController < ApplicationController
end
def kill_client_socket(client_socket)
# Do nothing if the socket is not passed, i.e., because the pipe broke
return unless client_socket
# We don't want to store this (arbitrary) exit command and redirect it ourselves
client_socket.send_data JSON.dump({cmd: :exit})
client_socket.send_data nil, :close