From 6ed01850383c3361ebab5c7525b7767e7242656d Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 16 Oct 2020 19:07:26 +0200 Subject: [PATCH] Refactor handling of new lines for Docker --- app/controllers/submissions_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index b17220dc..d1f9361b 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -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])