Browse Source

final link rewrite on ctrl+c

Nick Sweeting 6 years ago
parent
commit
9cdceecda8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      archivebox/archive_methods.py

+ 5 - 2
archivebox/archive_methods.py

@@ -120,16 +120,19 @@ def archive_link(link: Link, link_dir: Optional[str]=None) -> Link:
         # print('    ', stats)
         # print('    ', stats)
 
 
         # If any changes were made, update the link index json and html
         # If any changes were made, update the link index json and html
-        write_link_index(link.link_dir, link)
+        write_link_index(link, link_dir=link.link_dir)
         
         
         was_changed = stats['succeeded'] or stats['failed']
         was_changed = stats['succeeded'] or stats['failed']
         if was_changed:
         if was_changed:
             patch_links_index(link)
             patch_links_index(link)
 
 
-
         log_link_archiving_finished(link, link.link_dir, is_new, stats)
         log_link_archiving_finished(link, link.link_dir, is_new, stats)
 
 
     except KeyboardInterrupt:
     except KeyboardInterrupt:
+        try:
+            write_link_index(link, link_dir=link.link_dir)
+        except:
+            pass
         raise
         raise
 
 
     except Exception as err:
     except Exception as err: