summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-09-16 09:50:21 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-09-16 09:50:21 +0100
commit0cf2c9f8ec52b1ae276c1573210d252ab0c4577b (patch)
treea5d4a531b192cfd76000dac5445c726d63f872b0 /src
parent96423b52302a01fa3a4922961bd8e072a5c46e15 (diff)
replace subprocess.Popen.wait with subprocess.Popen.communicate everywhere we use pipes to avoid deadlocks
Diffstat (limited to 'src')
-rw-r--r--src/backend/setprofile.py8
-rw-r--r--src/backend/sync.py40
2 files changed, 24 insertions, 24 deletions
diff --git a/src/backend/setprofile.py b/src/backend/setprofile.py
index a5d6480..87d5437 100644
--- a/src/backend/setprofile.py
+++ b/src/backend/setprofile.py
@@ -7,12 +7,12 @@ import subprocess
@animation.wait('setting up profile')
def start():
if platform.uname()[4] == 'x86_64':
- eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/amd64/17.1/hardened'])
- eselectExec.wait()
+ eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/amd64/17.1/hardened'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = eselectExec.communicate()
if platform.uname()[4] == 'aarch64':
- eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/arm64/17.0'])
- eselectExec.wait()
+ eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/arm64/17.0'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = eselectExec.communicate()
envExec = subprocess.Popen(['env-update'], stdout=subprocess.DEVNULL)
envExec.wait()
diff --git a/src/backend/sync.py b/src/backend/sync.py
index 2490c04..0f28823 100644
--- a/src/backend/sync.py
+++ b/src/backend/sync.py
@@ -9,37 +9,37 @@ def portage():
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
- gitExecStage1.wait()
+ gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage1.communicate()
- gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
- gitExecStage2.wait()
+ gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage2.communicate()
def overlay():
os.chdir(sisyphus.filesystem.redcoreRepoDir)
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
- gitExecStage1.wait()
+ gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage1.communicate()
- gitExecStage1 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
- gitExecStage1.wait()
+ gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage2.communicate()
def portageCfg():
os.chdir(sisyphus.filesystem.portageConfigDir)
localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
- gitExecStage1 = subprocess.Popen(['git', 'stash'], stdout=subprocess.PIPE)
- gitExecStage1.wait()
- gitExecStage2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE)
- gitExecStage2.wait()
- gitExecStage3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE)
- gitExecStage3.wait()
- gitExecStage4 = subprocess.Popen(['git', 'stash', 'apply'], stdout=subprocess.PIPE)
- gitExecStage4.wait()
- gitExecStage5 = subprocess.Popen(['git', 'stash', 'clear'], stdout=subprocess.PIPE)
- gitExecStage5.wait()
- gitExecStage6 = subprocess.Popen(['git', 'gc', '--prune=now', '--quiet'], stdout=subprocess.PIPE)
- gitExecStage6.wait()
+ gitExecStage1 = subprocess.Popen(['git', 'stash'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage1.communicate()
+ gitExecStage2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage2.communicate()
+ gitExecStage3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage3.communicate()
+ gitExecStage4 = subprocess.Popen(['git', 'stash', 'apply'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage4.communicate()
+ gitExecStage5 = subprocess.Popen(['git', 'stash', 'clear'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage5.communicate()
+ gitExecStage6 = subprocess.Popen(['git', 'gc', '--prune=now', '--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = gitExecStage6.communicate()