From 96423b52302a01fa3a4922961bd8e072a5c46e15 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 16 Sep 2022 01:06:50 +0100 Subject: bugfix : * subprocess.Popen child processes can "sometimes" generate a very large output, causing a deadlock (**cough** dependency solver **cough**) * use subprocess.Popen.communicate instead of subprocess.Popen.wait to avoid such issues * see : https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait --- src/backend/solvedeps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/solvedeps.py') diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py index 85d245a..f0af4c0 100644 --- a/src/backend/solvedeps.py +++ b/src/backend/solvedeps.py @@ -10,6 +10,7 @@ def package(pkgname): areSources = [] needsConfig = int() portageExec = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = portageExec.communicate() for portageOutput in io.TextIOWrapper(portageExec.stderr, encoding="utf-8"): if "The following keyword changes are necessary to proceed:" in portageOutput.rstrip(): @@ -33,7 +34,6 @@ def package(pkgname): isSource = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ ")) areSources.append(isSource) - portageExec.wait() return areBinaries,areSources,needsConfig @animation.wait('resolving dependencies') @@ -42,6 +42,7 @@ def world(): areSources = [] needsConfig = int() portageExec = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = portageExec.communicate() for portageOutput in io.TextIOWrapper(portageExec.stderr, encoding="utf-8"): if "The following keyword changes are necessary to proceed:" in portageOutput.rstrip(): @@ -65,5 +66,4 @@ def world(): isSource = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ ")) areSources.append(isSource) - portageExec.wait() return areBinaries,areSources,needsConfig -- cgit v1.2.3