Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2022-01-30 17:24:01 +0100
committerAnton Hvornum <anton@hvornum.se>2022-01-30 17:24:01 +0100
commit281ccf99a4340af54823e931ee32ad8450dbc147 (patch)
treeb7316e62bd901a5785c64229627ecb974fb7db85 /archinstall
parent179c103cddf930b91ffa82a9feee37c7f2487ed8 (diff)
Fixed an issue where SysCommand() never utilized the SysCommandWorker() context, which means SysCommandWorker() never closed the pty, hogging all system handles for it.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/general.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 680e41cd..a3976234 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -427,13 +427,20 @@ class SysCommand:
}
def create_session(self) -> bool:
+ """
+ Initiates a :ref:`SysCommandWorker` session in this class ``.session``.
+ It then proceeds to poll the process until it ends, after which it also
+ clears any printed output if ``.peak_output=True``.
+ """
if self.session:
- return True
+ return self.session
- self.session = SysCommandWorker(self.cmd, callbacks=self._callbacks, peak_output=self.peak_output, environment_vars=self.environment_vars)
+ with SysCommandWorker(self.cmd, callbacks=self._callbacks, peak_output=self.peak_output, environment_vars=self.environment_vars) as session:
+ if not self.session:
+ self.session = session
- while self.session.ended is None:
- self.session.poll()
+ while self.session.ended is None:
+ self.session.poll()
if self.peak_output:
sys.stdout.write('\n')