Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to pass extra kwargs to subprocess #355

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pylatex/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ def generate_tex(self, filepath=None):
super().generate_tex(self._select_filepath(filepath))

def generate_pdf(self, filepath=None, *, clean=True, clean_tex=True,
compiler=None, compiler_args=None, silent=True):
compiler=None, compiler_args=None, silent=True,
check_output_kwargs=None):
"""Generate a pdf file from the document.

Args
Expand All @@ -200,6 +201,10 @@ def generate_pdf(self, filepath=None, *, clean=True, clean_tex=True,
this is None it defaults to an empty list.
silent: bool
Whether to hide compiler output
check_output_kwargs: `dict` or `None`
Extra keyword arguments that should be passed to the subprocess
that runs the LaTeX compiler. If this is None it defaults to an
empty dictionary.
"""

if compiler_args is None:
Expand Down Expand Up @@ -237,9 +242,10 @@ def generate_pdf(self, filepath=None, *, clean=True, clean_tex=True,

main_arguments = ['--interaction=nonstopmode', filepath + '.tex']

check_output_kwargs = {}
if check_output_kwargs is None:
check_output_kwargs = {}
if python_cwd_available:
check_output_kwargs = {'cwd': dest_dir}
check_output_kwargs.update({'cwd': dest_dir})

os_error = None

Expand Down