# HG changeset patch # User Mads Kiilerich # Date 2020-08-18 13:52:58 # Node ID 659ecd26002cc926cad2ceeb91790363b2d350c8 # Parent 43d9615facc6a6182fc4259561d015041d947f9c vcs: fix subprocessio handling of hack for handling end-of-stream Address pytype warning: File "kallithea/lib/vcs/subprocessio.py", line 383, in __next__: No attribute 'stop' on listiterator[bytes] [attribute-error] diff --git a/kallithea/lib/vcs/subprocessio.py b/kallithea/lib/vcs/subprocessio.py --- a/kallithea/lib/vcs/subprocessio.py +++ b/kallithea/lib/vcs/subprocessio.py @@ -380,23 +380,23 @@ class SubprocessIOChunker(object): if (returncode is not None # process has terminated and returncode != 0 ): # and it failed - self.output.stop() + getattr(self.output, 'stop', lambda: None)() self.error.stop() err = ''.join(self.error) raise EnvironmentError("Subprocess exited due to an error:\n" + err) return next(self.output) def throw(self, type, value=None, traceback=None): - if self.output.length or not self.output.done_reading: + if getattr(self.output, 'length') or not getattr(self.output, 'done_reading'): raise type(value) def close(self): try: - self.process.terminate() + getattr(self.output, 'terminate', lambda: None)() except: pass try: - self.output.close() + getattr(self.output, 'close', lambda: None)() except: pass try: