From 9192d902c0fb1f58bfe62bc50b1846704161aad5 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 1 Oct 2018 13:46:25 +0200 Subject: [PATCH] Fix stripping of CRLF on Windows. --- lib/matplotlib/dviread.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index f064113adae5..91a9bd37f021 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -1017,16 +1017,16 @@ def find_tex_file(filename, format=None): if format is not None: cmd += ['--format=' + format] cmd += [filename] - try: # Below: strip final newline. - result = cbook._check_and_log_subprocess(cmd, _log)[:-1] + try: + result = cbook._check_and_log_subprocess(cmd, _log) except RuntimeError: return '' if os.name == 'nt': # On Windows only, kpathsea appears to use utf-8 output(?); see # __win32_fputs in the kpathsea sources and mpl issue #11848. - return result.decode('utf-8') + return result.decode('utf-8').rstrip('\r\n') else: - return os.fsdecode(result) + return os.fsdecode(result).rstrip('\n') @lru_cache()