Skip to content

Commit 9b7d5e4

Browse files
committed
mv: also cleanup on SIGINT
1 parent 763a669 commit 9b7d5e4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

library/utils/shell_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ def rename_move_file(src, dst, simulate=False):
3131
if os.path.isfile(src) and os.path.isfile(dst):
3232
os.unlink(dst)
3333
raise
34-
34+
except KeyboardInterrupt:
35+
if os.path.isfile(src) and os.path.isfile(dst):
36+
os.unlink(dst)
3537

3638
def rename_no_replace(src, dst):
3739
if os.path.exists(dst) and not os.path.isdir(dst):

library/utils/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __enter__(self):
217217

218218
def __exit__(self, exc_type, exc_value, traceback):
219219
if self.temp_file:
220-
os.remove(self.temp_file.name)
220+
os.unlink(self.temp_file.name)
221221

222222

223223
def download_embeds(args, soup):

0 commit comments

Comments
 (0)