Refactor handling of new lines for Docker

This commit is contained in:
Sebastian Serth
2020-10-16 19:07:26 +02:00
parent ff29cd906a
commit 6ed0185038

View File

@ -184,9 +184,8 @@ class SubmissionsController < ApplicationController
# Check whether the client send a JSON command and kill container
# if the command is 'client_kill', send it to docker otherwise.
begin
next if data == "\n"
parsed = JSON.parse(data)
parsed = JSON.parse(data) unless data == "\n"
if parsed.class == Hash && parsed['cmd'] == 'client_kill'
Rails.logger.debug("Client exited container.")
@docker_client.kill_container(result[:container])