Skip to content

Commit c90234f

Browse files
authored
Merge pull request #27785 from tacaswell/fix/windows_pgf_shutdown
FIX: be careful about communicating with subprocess
2 parents 27c3dc9 + 41bf7cc commit c90234f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ def _setup_latex_process(self, *, expect_reply=True):
257257
# Open LaTeX process for real work; register it for deletion. On
258258
# Windows, we must ensure that the subprocess has quit before being
259259
# able to delete the tmpdir in which it runs; in order to do so, we
260-
# must first `kill()` it, and then `communicate()` with it.
260+
# must first `kill()` it, and then `communicate()` with or `wait()` on
261+
# it.
261262
try:
262263
self.latex = subprocess.Popen(
263264
[mpl.rcParams["pgf.texsystem"], "-halt-on-error"],
@@ -274,7 +275,10 @@ def _setup_latex_process(self, *, expect_reply=True):
274275

275276
def finalize_latex(latex):
276277
latex.kill()
277-
latex.communicate()
278+
try:
279+
latex.communicate()
280+
except RuntimeError:
281+
latex.wait()
278282

279283
self._finalize_latex = weakref.finalize(
280284
self, finalize_latex, self.latex)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy