Copy output file from temporary directory
This commit is contained in:
parent
2fbb9878c2
commit
e202f5cd19
@ -25,6 +25,7 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -606,14 +607,16 @@ class TreePdfDoc(TreeDocBase):
|
|||||||
self._filename += ".pdf"
|
self._filename += ".pdf"
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
basename = os.path.basename(self._filename)
|
||||||
args = ['lualatex', '-output-directory', tmpdir,
|
args = ['lualatex', '-output-directory', tmpdir,
|
||||||
'-jobname', self._filename[:-4]]
|
'-jobname', basename[:-4]]
|
||||||
if win():
|
if win():
|
||||||
proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
||||||
creationflags=DETACHED_PROCESS)
|
creationflags=DETACHED_PROCESS)
|
||||||
else:
|
else:
|
||||||
proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
proc.communicate(input=self._tex.getvalue().encode('utf-8'))
|
proc.communicate(input=self._tex.getvalue().encode('utf-8'))
|
||||||
|
shutil.copy(os.path.join(tmpdir, basename), self._filename)
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user