diff --git a/app/controllers/execution_environments_controller.rb b/app/controllers/execution_environments_controller.rb index 5b966fb1..9d714af6 100644 --- a/app/controllers/execution_environments_controller.rb +++ b/app/controllers/execution_environments_controller.rb @@ -31,8 +31,8 @@ class ExecutionEnvironmentsController < ApplicationController def execute_command runner = Runner.for(current_user, @execution_environment) - output = runner.execute_command(params[:command]) - render(json: output) + output = runner.execute_command(params[:command], raise_exception: false) + render json: output end def working_time_query diff --git a/app/models/execution_environment.rb b/app/models/execution_environment.rb index 3bb86331..615f9ceb 100644 --- a/app/models/execution_environment.rb +++ b/app/models/execution_environment.rb @@ -79,7 +79,7 @@ class ExecutionEnvironment < ApplicationRecord def working_docker_image? runner = Runner.for(author, self) - output = runner.execute_command(VALIDATION_COMMAND, raise_exception: true) + output = runner.execute_command(VALIDATION_COMMAND) errors.add(:docker_image, "error: #{output[:stderr]}") if output[:stderr].present? rescue Runner::Error => e errors.add(:docker_image, "error: #{e}") diff --git a/app/models/runner.rb b/app/models/runner.rb index 21af9d96..63582b6a 100644 --- a/app/models/runner.rb +++ b/app/models/runner.rb @@ -64,7 +64,7 @@ class Runner < ApplicationRecord Time.zone.now - starting_time # execution duration end - def execute_command(command, raise_exception: false) + def execute_command(command, raise_exception: true) output = {} stdout = +'' stderr = +'' diff --git a/spec/models/execution_environment_spec.rb b/spec/models/execution_environment_spec.rb index 2d7b1e48..5b41f4b8 100644 --- a/spec/models/execution_environment_spec.rb +++ b/spec/models/execution_environment_spec.rb @@ -162,7 +162,7 @@ describe ExecutionEnvironment do it 'executes the validation command' do allow(runner).to receive(:execute_command).and_return({}) working_docker_image? - expect(runner).to have_received(:execute_command).with(ExecutionEnvironment::VALIDATION_COMMAND, raise_exception: true) + expect(runner).to have_received(:execute_command).with(ExecutionEnvironment::VALIDATION_COMMAND) end context 'when the command produces an error' do