mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use atomic_rename
This commit is contained in:
parent
ac29ca24a7
commit
0319ad478a
@ -16,6 +16,7 @@ from calibre.ebooks.metadata.pdf import page_images
|
|||||||
from calibre.gui2 import must_use_qt
|
from calibre.gui2 import must_use_qt
|
||||||
from calibre.gui2.webengine import secure_webengine
|
from calibre.gui2.webengine import secure_webengine
|
||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
|
from calibre.utils.filenames import atomic_rename
|
||||||
|
|
||||||
LOAD_TIMEOUT = 20
|
LOAD_TIMEOUT = 20
|
||||||
PRINT_TIMEOUT = 10
|
PRINT_TIMEOUT = 10
|
||||||
@ -79,7 +80,7 @@ def main(path_to_html, tdir, image_format='jpeg'):
|
|||||||
if ret == 0:
|
if ret == 0:
|
||||||
page_images('rendered.pdf', image_format=image_format)
|
page_images('rendered.pdf', image_format=image_format)
|
||||||
ext = {'jpeg': 'jpg'}.get(image_format, image_format)
|
ext = {'jpeg': 'jpg'}.get(image_format, image_format)
|
||||||
os.rename('page-images-1.' + ext, 'rendered.' + image_format)
|
atomic_rename('page-images-1.' + ext, 'rendered.' + image_format)
|
||||||
return ret == 0
|
return ret == 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user