commit:     c4049323b3c4c04ccc56023fa31169da58b57831
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb  9 08:47:31 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb  9 08:51:17 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c4049323

Revert "gpkg: on error, close stdin before killing external programs"

This reverts commit fba76a545f29fb8b529197c25c64700ef77413ae. This seems
to cause hangs in CI with pypy3.

Zac mentioned this at 
https://github.com/gentoo/portage/pull/1246#issuecomment-1935511379
and I can reproduce it with `tox -e pypy3-test` with PyPy 7.3.15.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/gpkg.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index 05f1b5f2a6..031b3f87cb 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -149,9 +149,9 @@ class tar_stream_writer:
         kill external program if any error happened in python
         """
         if self.proc is not None:
-            self.proc.stdin.close()
-            self.proc.kill()
             self.killed = True
+            self.proc.kill()
+            self.proc.stdin.close()
             self.close()
 
     def _cmd_read_thread(self):
@@ -347,9 +347,9 @@ class tar_stream_reader:
         kill external program if any error happened in python
         """
         if self.proc is not None:
-            self.proc.stdin.close()
-            self.proc.kill()
             self.killed = True
+            self.proc.kill()
+            self.proc.stdin.close()
             self.close()
 
     def read(self, bufsize=-1):

Reply via email to