File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ def _read_until(self, terminator):
124124 raise _ConverterError
125125 buf .extend (c )
126126 if buf .endswith (terminator ):
127- return bytes (buf [: - len ( terminator )] )
127+ return bytes (buf )
128128
129129
130130class _GSConverter (_Converter ):
@@ -154,15 +154,16 @@ def encode_and_escape(name):
154154 + b") run flush\n " )
155155 self ._proc .stdin .flush ()
156156 # GS> if nothing left on the stack; GS<n> if n items left on the stack.
157- err = self ._read_until (b"GS" )
158- stack = self ._read_until (b">" )
157+ err = self ._read_until ((b"GS<" , b"GS>" ))
158+ stack = ""
159+ if err .endswith (b"GS<" ):
160+ stack = self ._read_until (b">" )
159161 if stack or not os .path .exists (dest ):
160- stack_size = int (stack [1 : ]) if stack else 0
162+ stack_size = int (stack [: - 1 ]) if stack else 0
161163 self ._proc .stdin .write (b"pop\n " * stack_size )
162164 # Using the systemencoding should at least get the filenames right.
163165 raise ImageComparisonFailure (
164- (err + b"GS" + stack + b">" )
165- .decode (sys .getfilesystemencoding (), "replace" ))
166+ (err + stack ).decode (sys .getfilesystemencoding (), "replace" ))
166167
167168
168169class _SVGConverter (_Converter ):
You can’t perform that action at this time.
0 commit comments