From 50b62b57034d7d15784fe3c35cdedc1e86a8deca Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 18 Oct 2021 01:22:26 +0200 Subject: [PATCH] Move flush_buffers method in Runner::Connection --- lib/runner/connection.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/runner/connection.rb b/lib/runner/connection.rb index ab3f5279..1e523b59 100644 --- a/lib/runner/connection.rb +++ b/lib/runner/connection.rb @@ -78,6 +78,11 @@ class Runner::Connection raise NotImplementedError end + def flush_buffers + @stdout_callback.call @stdout_buffer.flush unless @stdout_buffer.empty? + @stderr_callback.call @stderr_buffer.flush unless @stderr_buffer.empty? + end + # === WebSocket Callbacks # These callbacks are executed based on events indicated by Faye WebSockets and are # independent of the JSON specification that is used within the WebSocket once established. @@ -162,10 +167,4 @@ class Runner::Connection def handle_timeout(_event) @status = :timeout end - - def flush_buffers - @stdout_callback.call @stdout_buffer.flush unless @stdout_buffer.empty? - @stderr_callback.call @stderr_buffer.flush unless @stderr_buffer.empty? - end - private :flush_buffers end