File tree 1 file changed +7
-6
lines changed 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):
124
124
raise _ConverterError
125
125
buf .extend (c )
126
126
if buf .endswith (terminator ):
127
- return bytes (buf [: - len ( terminator )] )
127
+ return bytes (buf )
128
128
129
129
130
130
class _GSConverter (_Converter ):
@@ -154,15 +154,16 @@ def encode_and_escape(name):
154
154
+ b") run flush\n " )
155
155
self ._proc .stdin .flush ()
156
156
# 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">" )
159
161
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
161
163
self ._proc .stdin .write (b"pop\n " * stack_size )
162
164
# Using the systemencoding should at least get the filenames right.
163
165
raise ImageComparisonFailure (
164
- (err + b"GS" + stack + b">" )
165
- .decode (sys .getfilesystemencoding (), "replace" ))
166
+ (err + stack ).decode (sys .getfilesystemencoding (), "replace" ))
166
167
167
168
168
169
class _SVGConverter (_Converter ):
You can’t perform that action at this time.
0 commit comments