Browse Source

only print stats if not Ctrl-C'ed

if the user interrupts by ctrl-c, we do not save the archive,
thus we can not show stats because archive.id will not be in
the chunks index.
Thomas Waldmann 4 years ago
parent
commit
649603f247
1 changed files with 14 additions and 14 deletions
  1. 14 14
      src/borg/archiver.py

+ 14 - 14
src/borg/archiver.py

@@ -617,20 +617,20 @@ class Archiver:
                     self.print_error("Got Ctrl-C / SIGINT.")
                     self.print_error("Got Ctrl-C / SIGINT.")
                 else:
                 else:
                     archive.save(comment=args.comment, timestamp=args.timestamp, stats=archive.stats)
                     archive.save(comment=args.comment, timestamp=args.timestamp, stats=archive.stats)
-                args.stats |= args.json
-                if args.stats:
-                    if args.json:
-                        json_print(basic_json_data(manifest, cache=cache, extra={
-                            'archive': archive,
-                        }))
-                    else:
-                        log_multi(DASHES,
-                                  str(archive),
-                                  DASHES,
-                                  STATS_HEADER,
-                                  str(archive.stats),
-                                  str(cache),
-                                  DASHES, logger=logging.getLogger('borg.output.stats'))
+                    args.stats |= args.json
+                    if args.stats:
+                        if args.json:
+                            json_print(basic_json_data(manifest, cache=cache, extra={
+                                'archive': archive,
+                            }))
+                        else:
+                            log_multi(DASHES,
+                                      str(archive),
+                                      DASHES,
+                                      STATS_HEADER,
+                                      str(archive.stats),
+                                      str(cache),
+                                      DASHES, logger=logging.getLogger('borg.output.stats'))
 
 
         self.output_filter = args.output_filter
         self.output_filter = args.output_filter
         self.output_list = args.output_list
         self.output_list = args.output_list