Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/general.py
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2022-02-03 00:02:30 +0100
committerGitHub <noreply@github.com>2022-02-03 00:02:30 +0100
commit3cd7dc24c7ebe8911978380d75fd79e0c581060a (patch)
tree1aa329b24f0eb41289f3b60d67218604e49b5873 /archinstall/lib/general.py
parent389feef035cfbb1bd2c4f8be070fa085c088f151 (diff)
Command locales (second batch) (#886)
* flexibilize the definition of execution locale for OS commands executed via the SysCommand* interface. Defined a storage argument which holds the default Added functions to unset the program own locales reset to the program default locales set a specific locale A decorator to execute functions in the host locale environment * rename decorator local_environ to host_locale_environ created a simmetric decorator c_locale_environ, to make a routine work with the C locale whatever is set * Correct definition of btrfs standard layout * Added error handling * Fixed issue where archinstall.Boot() would raise an exception in vain * Added debugging for SysCommandWorker() * Added some debugging * Tweaking debug a bit * Tweaking debug * Adding more debug * Adding more debug * Removed some debugging * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Adding more debug * Removed soem debugging * Removed soem debugging * Testing a revert * Adding back the reverted change, adding lofile * Redirecting stdout to /dev/null for testing (to avoid interrupting the fork) * Reverted debug changes * Testing os.system() Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/general.py')
-rw-r--r--archinstall/lib/general.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index a5444801..c9ebb921 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -203,7 +203,7 @@ class SysCommandWorker:
self.callbacks = callbacks
self.peak_output = peak_output
# define the standard locale for command outputs. For now the C ascii one. Can be overriden
- self.environment_vars = {'LC_ALL':'C' , **environment_vars}
+ self.environment_vars = {**storage.get('CMD_LOCALE',{}),**environment_vars}
self.logfile = logfile
self.working_directory = working_directory
@@ -262,10 +262,10 @@ class SysCommandWorker:
sys.stdout.flush()
if len(args) >= 2 and args[1]:
- log(args[1], level=logging.ERROR, fg='red')
+ log(args[1], level=logging.DEBUG, fg='red')
if self.exit_code != 0:
- raise SysCallError(f"{self.cmd} exited with abnormal exit code: {self.exit_code}", self.exit_code)
+ raise SysCallError(f"{self.cmd} exited with abnormal exit code [{self.exit_code}]: {self._trace_log[:500]}", self.exit_code)
def is_alive(self) -> bool:
self.poll()
@@ -350,9 +350,11 @@ class SysCommandWorker:
# and until os.close(), the traceback will get locked inside
# stdout of the child_fd object. `os.read(self.child_fd, 8192)` is the
# 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:
try:
try: