This commit is contained in:
邱博亞 2024-05-09 20:55:13 +08:00
parent 21f9e32d0d
commit 51698a70d1
1 changed files with 6 additions and 9 deletions

View File

@ -264,16 +264,16 @@ namespace :exec_commands do
print data_str unless @no_stdout
data_str.gsub!(/\r\n/, "\n")
next if data_str.length == 0
output_lines = data_str.split("\n")
output_lines = data_str.split("\n", -1)
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
@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
@ -285,9 +285,6 @@ namespace :exec_commands do
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