Show a localized message if the program was killed.

* This will most likely happen by the OOM killer, thus we inform the user about the memory restriction.
This commit is contained in:
Sebastian Serth
2022-04-15 21:29:55 +02:00
parent 5f7838ef46
commit 19bd742bc9
10 changed files with 37 additions and 7 deletions

View File

@ -78,13 +78,14 @@ class Runner < ApplicationRecord
stdout = +''
stderr = +''
try = 0
exit_code = 1 # default to error
begin
if try.nonzero?
request_new_id
save
end
exit_code = 1 # default to error
execution_time = attach_to_execution(command) do |socket|
socket.on :stderr do |data|
stderr << data
@ -120,7 +121,9 @@ class Runner < ApplicationRecord
# We forward the exception if requested
raise e if raise_exception && defined?(e) && e.present?
output.merge!(stdout: stdout, stderr: stderr)
# If the process was killed with SIGKILL, it is most likely that the OOM killer was triggered.
output[:status] = :out_of_memory if exit_code == 137
output.merge!(stdout: stdout, stderr: stderr, exit_code: exit_code)
end
end