Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrvantage <3941997+mrvantage@users.noreply.github.com>2023-03-10 14:58:41 +0100
committerGitHub <noreply@github.com>2023-03-10 14:58:41 +0100
commite4f3198505c736e8825a6fd056b71f9a7336c1d3 (patch)
tree8c1414db2894899950a0d9774106723ca2036c48
parent5669f3ba4660d3be76e2993af30c1787e2ac3915 (diff)
Error handling cmd history (#1560)
* If we encounter a FileNotFoundError, the cmd_history.txt file or parent directory does not exist. This leads to vague errors upstream of cmd executable file not existing if this is the case. Probably this is a valid situation and we should just pass on the error.
-rw-r--r--archinstall/lib/general.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index bf32a9a8..5fd655a2 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -391,6 +391,13 @@ class SysCommandWorker:
os.chmod(str(history_logfile), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
except PermissionError:
pass
+ # If history_logfile does not exist, ignore the error
+ except FileNotFoundError:
+ pass
+ except Exception as e:
+ exception_type = type(e).__name__
+ log(f"Unexpected {exception_type} occurred in {self.cmd}: {e}", level=logging.ERROR)
+ raise e
os.execve(self.cmd[0], list(self.cmd), {**os.environ, **self.environment_vars})
if storage['arguments'].get('debug'):