MCPcopy Index your code
hub / github.com/archlinux/archinstall / create_session

Method create_session

archinstall/lib/command.py:274–299  ·  view source on GitHub ↗

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 ``.peek_output=True``.

(self)

Source from the content-addressed store, hash-verified

272 return self.decode('UTF-8', errors='backslashreplace') or ''
273
274 def create_session(self) -> bool:
275 """
276 Initiates a :ref:`SysCommandWorker` session in this class ``.session``.
277 It then proceeds to poll the process until it ends, after which it also
278 clears any printed output if ``.peek_output=True``.
279 """
280 if self.session:
281 return True
282
283 with SysCommandWorker(
284 self.cmd,
285 peek_output=self.peek_output,
286 environment_vars=self.environment_vars,
287 remove_vt100_escape_codes_from_lines=self.remove_vt100_escape_codes_from_lines,
288 working_directory=self.working_directory,
289 ) as session:
290 self.session = session
291
292 while not self.session.ended:
293 self.session.poll()
294
295 if self.peek_output:
296 sys.stdout.write('\n')
297 sys.stdout.flush()
298
299 return True
300
301 def decode(self, encoding: str = 'utf-8', errors: str = 'backslashreplace', strip: bool = True) -> str:
302 if not self.session:

Callers 1

__init__Method · 0.95

Calls 3

SysCommandWorkerClass · 0.70
pollMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected