Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib')
-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')