index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2022-01-30 17:24:01 +0100 |
---|---|---|
committer | Anton Hvornum <anton@hvornum.se> | 2022-01-30 17:24:01 +0100 |
commit | 281ccf99a4340af54823e931ee32ad8450dbc147 (patch) | |
tree | b7316e62bd901a5785c64229627ecb974fb7db85 | |
parent | 179c103cddf930b91ffa82a9feee37c7f2487ed8 (diff) |
-rw-r--r-- | archinstall/lib/general.py | 15 |
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') |