Skip to content

Commit

Permalink
gpkg: on error, close stdin before killing external programs
Browse files Browse the repository at this point in the history
Otherwise, this may trigger a BrokenPipeError.  Sensitive to buffer
fullness, this was observed on 64k page size system immediately after
triggering E2BIG error from kernel.

Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
matoro authored and thesamesam committed Feb 9, 2024
1 parent ca8d461 commit fba76a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/portage/gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def kill(self):
kill external program if any error happened in python
"""
if self.proc is not None:
self.killed = True
self.proc.kill()
self.proc.stdin.close()
self.proc.kill()
self.killed = True
self.close()

def _cmd_read_thread(self):
Expand Down Expand Up @@ -347,9 +347,9 @@ def kill(self):
kill external program if any error happened in python
"""
if self.proc is not None:
self.killed = True
self.proc.kill()
self.proc.stdin.close()
self.proc.kill()
self.killed = True
self.close()

def read(self, bufsize=-1):
Expand Down

0 comments on commit fba76a5

Please sign in to comment.