lib/coursemology/evaluator/utils.rb in coursemology-evaluator-0.1.0 vs lib/coursemology/evaluator/utils.rb in coursemology-evaluator-0.1.1

- old
+ new

@@ -1,5 +1,6 @@ +# frozen_string_literal: true module Coursemology::Evaluator::Utils # Represents one block of the Docker Attach protocol. DockerAttachBlock = Struct.new(:stream, :length, :bytes) # Parses a Docker +attach+ protocol stream into its constituent protocols. @@ -9,10 +10,10 @@ # This drops all blocks belonging to streams other than STDIN, STDOUT, or STDERR. # # @param [String] string The input stream to parse. # @return [Array<(String, String, String)>] The stdin, stdout, and stderr output. def self.parse_docker_stream(string) - result = ['', '', ''] + result = [''.dup, ''.dup, ''.dup] stream = StringIO.new(string) while (block = parse_docker_stream_read_block(stream)) next if block.stream >= result.length result[block.stream] << block.bytes