Split WebSocket event in multiple lines before processing

This commit is contained in:
Sebastian Serth
2021-10-10 15:12:45 +02:00
parent 1403fc03c4
commit cc98dc2229
3 changed files with 22 additions and 16 deletions

View File

@ -121,9 +121,9 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy
"#{data}\n"
end
def decode(raw_event)
case raw_event.data
when /@#{@strategy.container_id[0..11]}/
def decode(event_data)
case event_data
when /(@#{@strategy.container_id[0..11]}|#exit)/
# Assume correct termination for now and return exit code 0
# TODO: Can we use the actual exit code here?
@exit_code = 0
@ -135,11 +135,11 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy
when /\*\*\*\*\*\*\*\*\*\*\*\*\* Module/
# Identification of PyLint output, change stream back to stdout and return event
@stream = 'stdout'
{'type' => @stream, 'data' => raw_event.data}
{'type' => @stream, 'data' => event_data}
when /#{@strategy.command}/
when /bash: cmd:canvasevent: command not found/
else
{'type' => @stream, 'data' => raw_event.data}
{'type' => @stream, 'data' => event_data}
end
end
end