From e202f5cd1971c73c5968804d04f233cbee346e18 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Wed, 14 Feb 2018 22:43:40 +0000 Subject: [PATCH] Copy output file from temporary directory --- gramps/gen/plug/docgen/treedoc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gramps/gen/plug/docgen/treedoc.py b/gramps/gen/plug/docgen/treedoc.py index e61e61c00..78c778c79 100644 --- a/gramps/gen/plug/docgen/treedoc.py +++ b/gramps/gen/plug/docgen/treedoc.py @@ -25,6 +25,7 @@ #------------------------------------------------------------------------- from abc import ABCMeta, abstractmethod import os +import shutil from subprocess import Popen, PIPE from io import StringIO import tempfile @@ -606,14 +607,16 @@ class TreePdfDoc(TreeDocBase): self._filename += ".pdf" with tempfile.TemporaryDirectory() as tmpdir: + basename = os.path.basename(self._filename) args = ['lualatex', '-output-directory', tmpdir, - '-jobname', self._filename[:-4]] + '-jobname', basename[:-4]] if win(): proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, creationflags=DETACHED_PROCESS) else: proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) proc.communicate(input=self._tex.getvalue().encode('utf-8')) + shutil.copy(os.path.join(tmpdir, basename), self._filename) #------------------------------------------------------------------------------