lib/keepitsafe.rb in keepitsafe-0.2.2 vs lib/keepitsafe.rb in keepitsafe-0.2.3
- old
+ new
@@ -170,11 +170,11 @@
attr_accessor :start_time, :end_time, :log_buffer, :error, :free_before, :free_after, :backup_size
def set_backup_size remote_path
- raw = run_cmd("du -hc #{remote_path}").gsub("\n",' ').gsub("\t",' ').strip.match(/([0-9kmgt.]{2,10})\s*total/i)[1]
+ raw = (run_cmd("du -hc #{remote_path}").gsub("\n",' ').gsub("\t",' ').strip.match(/([0-9kmgt.]{2,10})\s*total/i) || [0])[1]
@backup_size = raw_to_meg(raw)
end
private
@@ -220,12 +220,14 @@
remove_pending_file
end
rescue StandardError => e
@error = e
+ puts e.message
puts e.inspect
puts e.backtrace
+ @log_buffer.puts e.message
@log_buffer.puts e.inspect
@log_buffer.puts e.backtrace
trigger('on_error',{:error => e})
end