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.
This commit is contained in:
Thomas Waldmann 2021-02-03 01:56:52 +01:00
parent 6844d33e7f
commit 649603f247
1 changed files with 14 additions and 14 deletions

View File

@ -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 args.stats |= args.json
if args.stats: if args.stats:
if args.json: if args.json:
json_print(basic_json_data(manifest, cache=cache, extra={ json_print(basic_json_data(manifest, cache=cache, extra={
'archive': archive, 'archive': archive,
})) }))
else: else:
log_multi(DASHES, log_multi(DASHES,
str(archive), str(archive),
DASHES, DASHES,
STATS_HEADER, STATS_HEADER,
str(archive.stats), str(archive.stats),
str(cache), str(cache),
DASHES, logger=logging.getLogger('borg.output.stats')) 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