diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-09-16 01:06:50 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-09-16 01:06:50 +0100 |
commit | 96423b52302a01fa3a4922961bd8e072a5c46e15 (patch) | |
tree | d31bdfd6415b4dec2cd427024435ef2ce47669ac /src/backend/solvedeps.py | |
parent | d5f7286a28caf0a7f628c09b515e7ed59a1a85fb (diff) |
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
Diffstat (limited to 'src/backend/solvedeps.py')
-rw-r--r-- | src/backend/solvedeps.py | 4 |
1 files changed, 2 insertions, 2 deletions
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 |