From a3b775c175c748516f327d902529229c8156bb5a Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 4 Jun 2023 16:29:40 +0800 Subject: bugfix: cache does not work across devices --- texgen.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'texgen.py') diff --git a/texgen.py b/texgen.py index 3a2964d..73277fc 100644 --- a/texgen.py +++ b/texgen.py @@ -3,6 +3,7 @@ import asyncio.subprocess as subprocess import contextlib import hashlib import os +import shlex import shutil from aiofile import async_open @@ -61,5 +62,9 @@ class TexGenerator: raise TexGenerationError('xelatex timed out') if proc.returncode != 0: raise TexGenerationError(f'xelatex process exited with non-zero code {proc.returncode}') - os.rename(os.path.join(workdir, f'{job_name}.pdf'), cache_file_path) + os.system(' '.join([ + 'mv', + shlex.quote(os.path.join(workdir, f'{job_name}.pdf')), + shlex.quote(cache_file_path), + ])) return cache_file_path -- cgit v1.2.3