From faafa438980684343e699cce765b431b10b2cd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Wed, 8 May 2024 23:56:43 +0800 Subject: [PATCH] test --- lib/tasks/exec_command.rake | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/lib/tasks/exec_command.rake b/lib/tasks/exec_command.rake index 24e0f79..c91c752 100644 --- a/lib/tasks/exec_command.rake +++ b/lib/tasks/exec_command.rake @@ -265,35 +265,11 @@ namespace :exec_commands do data_str.gsub!(/\r\n/, "\n") next if data_str.length == 0 output_lines = data_str.split("\n") - first_output = output_lines[0] - if first_output - if outputs.count != 0 - outputs[-1] += first_output - @remove_last_line = false - outputs[-1] = outputs[-1].sub(/(.+)\r(.+)/) do |s| - @remove_last_line = true - first_output = $2 - end - else - outputs << first_output - end - if update_outputs - update_thread_infos_for_exec(first_output,true) if @flag - update_infos_for_exec(first_output,true) - end - @remove_last_line = false - new_arr = output_lines[1..-1] - new_arr = new_arr.map do |output_line| - output_line = output_line.sub(/(.+)\r(.+)/, '\2') - end.select{|s| s.present?} - if data_str[-1] == "\n" - new_arr << "" - end - outputs += new_arr - if update_outputs - update_thread_infos_for_exec(new_arr,false,true) if @flag - update_infos_for_exec(new_arr,false,true) - end + output_lines << "" if data_str[-1] == "\n" + outputs += output_lines + if update_outputs + update_thread_infos_for_exec(output_lines,false,true) if @flag + update_infos_for_exec(output_lines,false,true) end end end