Skip to content

Commit 7bf2554

Browse files
greglucasQuLogic
authored andcommitted
Merge pull request #27785 from tacaswell/fix/windows_pgf_shutdown
FIX: be careful about communicating with subprocess (cherry picked from commit c90234f)
1 parent 240ff81 commit 7bf2554

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
@@ -307,7 +307,8 @@ def _setup_latex_process(self, *, expect_reply=True):
307307
# Open LaTeX process for real work; register it for deletion. On
308308
# Windows, we must ensure that the subprocess has quit before being
309309
# able to delete the tmpdir in which it runs; in order to do so, we
310-
# must first `kill()` it, and then `communicate()` with it.
310+
# must first `kill()` it, and then `communicate()` with or `wait()` on
311+
# it.
311312
try:
312313
self.latex = subprocess.Popen(
313314
[mpl.rcParams["pgf.texsystem"], "-halt-on-error"],
@@ -324,7 +325,10 @@ def _setup_latex_process(self, *, expect_reply=True):
324325

325326
def finalize_latex(latex):
326327
latex.kill()
327-
latex.communicate()
328+
try:
329+
latex.communicate()
330+
except RuntimeError:
331+
latex.wait()
328332

329333
self._finalize_latex = weakref.finalize(
330334
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