Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-03-23 11:42:12 +0100
committerAnton Hvornum <anton.feeds@gmail.com>2021-03-23 11:42:12 +0100
commitaceb0f3e98ea1009474f24cf02fdcf3e5923bcc7 (patch)
treebdbfa9671760704b87485a4597699771d62ade3e /archinstall
parentc5f6c4b71263ebfc2a6d840847328b672fd8d5c2 (diff)
Corrected recursion loop in log() calling log() before setting the new path for the log file on errors.
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/output.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py
index 18cbefe0..537fb695 100644
--- a/archinstall/lib/output.py
+++ b/archinstall/lib/output.py
@@ -97,14 +97,15 @@ def log(*args, **kwargs):
absolute_logfile = os.path.join(storage.get('LOG_PATH', './'), filename)
if not os.path.isfile(absolute_logfile):
try:
- os.makedirs(os.path.dirname(absolute_logfile))
+ Path(absolute_logfile).parents[0].mkdir(exist_ok=True, parents=True)
except PermissionError:
# Fallback to creating the log file in the current folder
- log(f"Not enough permission to place log file at {absolute_logfile}, creating it in {Path('./').absolute()} instead.", fg="red")
+ err_string = f"Not enough permission to place log file at {absolute_logfile}, creating it in {Path('./').absolute()/filename} instead."
absolute_logfile = Path('./').absolute()/filename
- absolute_logfile.makedirs(exist_ok=True)
+ absolute_logfile.parents[0].mkdir(exist_ok=True)
+ absolute_logfile = str(absolute_logfile)
storage['LOG_PATH'] = './'
-
+ log(err_string, fg="red")
Path(absolute_logfile).touch() # Overkill?