lib/asir/transport/payload_io.rb in asir-1.2.2 vs lib/asir/transport/payload_io.rb in asir-1.2.3

- old
+ new

@@ -29,11 +29,16 @@ stream.readline # FOOTER stream.readline payload end - def _read_line_and_expect! stream, regexp - line = stream.readline + def _read_line_and_expect! stream, regexp, consume = nil + ok = false + until ok + line = stream.readline + _log { "_read_line_and_expect! #{stream} #{line.inspect}" } + ok = consume && consume.match(line) ? false : true + end unless match = regexp.match(line) _log { "_read_line_and_expect! #{stream} #{regexp.inspect} !~ #{line.inspect}" } raise UnexpectedResponse, "expected #{regexp.inspect}, received #{line.inspect}" end match