diff --git a/lib/tasks/exec_command.rake b/lib/tasks/exec_command.rake index 7b298ce..b6849cf 100644 --- a/lib/tasks/exec_command.rake +++ b/lib/tasks/exec_command.rake @@ -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