index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2022-05-08 18:36:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 18:36:32 +0200 |
commit | 80cee500e0ef0cf4de84b8b60b35c25f667e7a34 (patch) | |
tree | a9393a7f71b8d53429bbd0dacb4172fc01bc526d /archinstall | |
parent | 5a1bd831324f4b6e997f5de4d5ef5c416354ad78 (diff) |
-rw-r--r-- | archinstall/lib/general.py | 13 |
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 174acb8a..cf925de3 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -352,7 +352,6 @@ class SysCommandWorker: # only way to get the traceback without loosing it. self.pid, self.child_fd = pty.fork() - os.chdir(old_dir) # https://stackoverflow.com/questions/4022600/python-pty-fork-how-does-it-work if not self.pid: @@ -371,6 +370,9 @@ class SysCommandWorker: log(f"{self.cmd[0]} does not exist.", level=logging.ERROR, fg="red") self.exit_code = 1 return False + else: + # Only parent process moves back to the original working directory + os.chdir(old_dir) self.started = time.time() self.poll_object.register(self.child_fd, EPOLLIN | EPOLLHUP) @@ -457,7 +459,14 @@ class SysCommand: if self.session: return self.session - with SysCommandWorker(self.cmd, callbacks=self._callbacks, peak_output=self.peak_output, environment_vars=self.environment_vars, remove_vt100_escape_codes_from_lines=self.remove_vt100_escape_codes_from_lines) as session: + with SysCommandWorker( + self.cmd, + callbacks=self._callbacks, + peak_output=self.peak_output, + environment_vars=self.environment_vars, + remove_vt100_escape_codes_from_lines=self.remove_vt100_escape_codes_from_lines, + working_directory=self.working_directory) as session: + if not self.session: self.session = session |