From 907430b1acd2c651b4da368237bf32d4e3c26dcc Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 10 Feb 2022 18:48:26 +0100 Subject: [PATCH] Fixing SysCommandWorker() --- archinstall/lib/general.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index c9277cf4..12be4cca 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -345,6 +345,12 @@ class SysCommandWorker: except ChildProcessError: self.exit_code = 1 + def is_child(self): + return self.pid == 0 + + def is_parent(self): + return self.pid > 0 + def execute(self) -> bool: import pty @@ -364,7 +370,7 @@ class SysCommandWorker: os.chdir(old_dir) # https://stackoverflow.com/questions/4022600/python-pty-fork-how-does-it-work - if not self.pid: + if self.is_child(): try: try: with open(f"{storage['LOG_PATH']}/cmd_history.txt", "a") as cmd_log: