Skip to content

Commit 9db40a0

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

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

library/createdb/tube_backend.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def run(self, info) -> tuple[list, dict]: # pylint: disable=arguments-renamed
201201
sys.stderr.write("\n")
202202
db_playlists.log_problem(args, playlist_path)
203203
else:
204+
if added_media_count > count_before_extract:
205+
sys.stderr.write("\n")
204206
if not pl:
205207
if args.safe:
206208
log.error("DownloadError skipping %s", playlist_path)

library/utils/shell_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ 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)
37+
raise
3538

3639
def rename_no_replace(src, dst):
3740
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)