Enabling archinstall.sys_command() to get a working directory when executing. The sys_command() is working pretty well for this very specific need, but this is an attempt to making it a bit more generic. A more general overhaul of the command should be done at some point.

This commit is contained in:
Anton Hvornum 2021-03-23 14:18:03 +01:00
parent aceb0f3e98
commit b672efdf6b
1 changed files with 5 additions and 1 deletions

View File

@ -106,7 +106,11 @@ class sys_command():#Thread):
user_catalogue = os.path.expanduser('~')
self.cwd = f"{user_catalogue}/.cache/archinstall/workers/{kwargs['worker_id']}/"
self.exec_dir = f'{self.cwd}/{os.path.basename(self.cmd[0])}_workingdir'
if (workdir := kwargs.get('workdir', None)):
self.exec_dir = workdir
else:
self.exec_dir = f'{self.cwd}/{os.path.basename(self.cmd[0])}_workingdir'
if not self.cmd[0][0] == '/':
# "which" doesn't work as it's a builtin to bash.