From 35454836c87feee22d7899111f7e1fa76c8c5de4 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 24 Apr 2022 18:26:05 +0200 Subject: [PATCH] Allow \r\n and \n line breaks for Connection::Buffer * Nomad sends CRLF-separated lines * AWS sends LF-separated lines --- lib/runner/connection/buffer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/runner/connection/buffer.rb b/lib/runner/connection/buffer.rb index b3421df8..12e99aa3 100644 --- a/lib/runner/connection/buffer.rb +++ b/lib/runner/connection/buffer.rb @@ -71,8 +71,8 @@ class Runner::Connection::Buffer @buffering = false @global_buffer = +'' # For our buffering, we identified line breaks with the `\n` and removed those temporarily. - # Thus, we now re-add the `\n` at the end of the string and remove the `\r` at the same time. - message = message.gsub(/\r$/, "\n") + # Thus, we now re-add the `\n` at the end of the string and (optionally) remove a trailing `\r` at the same time. + message = message.gsub(/\r?$/, "\n") @line_buffer.push message end