This commit is contained in:
邱博亞 2024-05-08 23:56:43 +08:00
parent 56a0797be3
commit faafa43898
1 changed files with 5 additions and 29 deletions

View File

@ -265,35 +265,11 @@ namespace :exec_commands do
data_str.gsub!(/\r\n/, "\n") data_str.gsub!(/\r\n/, "\n")
next if data_str.length == 0 next if data_str.length == 0
output_lines = data_str.split("\n") output_lines = data_str.split("\n")
first_output = output_lines[0] output_lines << "" if data_str[-1] == "\n"
if first_output outputs += output_lines
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 if update_outputs
update_thread_infos_for_exec(first_output,true) if @flag update_thread_infos_for_exec(output_lines,false,true) if @flag
update_infos_for_exec(first_output,true) update_infos_for_exec(output_lines,false,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
end end
end end
end end