Skip to content

Commit

Permalink
general: rework environment_vars (#3032)
Browse files Browse the repository at this point in the history
  • Loading branch information
codefiles authored Dec 20, 2024
1 parent f685849 commit 367c8d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 6 additions & 4 deletions archinstall/lib/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ def __init__(
cmd: str | list[str],
callbacks: dict[str, Any] | None = None,
peek_output: bool | None = False,
environment_vars: dict[str, Any] | None = None,
environment_vars: dict[str, str] | None = None,
logfile: None = None,
working_directory: str | None = './',
remove_vt100_escape_codes_from_lines: bool = True
):
callbacks = callbacks or {}
environment_vars = environment_vars or {}

if isinstance(cmd, str):
cmd = shlex.split(cmd)
Expand All @@ -126,7 +125,10 @@ def __init__(
self.callbacks = callbacks
self.peek_output = peek_output
# define the standard locale for command outputs. For now the C ascii one. Can be overridden
self.environment_vars = {**storage.get('CMD_LOCALE', {}), **environment_vars}
self.environment_vars = {'LC_ALL': 'C'}
if environment_vars:
self.environment_vars.update(environment_vars)

self.logfile = logfile
self.working_directory = working_directory

Expand Down Expand Up @@ -353,7 +355,7 @@ def __init__(
callbacks: dict[str, Callable[[Any], Any]] = {},
start_callback: Callable[[Any], Any] | None = None,
peek_output: bool | None = False,
environment_vars: dict[str, Any] | None = None,
environment_vars: dict[str, str] | None = None,
working_directory: str | None = './',
remove_vt100_escape_codes_from_lines: bool = True):

Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/luks.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _add_key(self, key_file: Path) -> None:
debug(f'Adding additional key-file {key_file}')

command = f'/usr/bin/cryptsetup -q -v luksAddKey {self.luks_dev_path} {key_file}'
worker = SysCommandWorker(command, environment_vars={'LC_ALL': 'C'})
worker = SysCommandWorker(command)
pw_injected = False

while worker.is_alive():
Expand Down
2 changes: 0 additions & 2 deletions archinstall/lib/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
'LOG_FILE': Path('install.log'),
'MOUNT_POINT': Path('/mnt/archinstall'),
'ENC_IDENTIFIER': 'ainst',
'CMD_LOCALE': {'LC_ALL': 'C'}, # default locale for execution commands. Can be overridden with set_cmd_locale()
'CMD_LOCALE_DEFAULT': {'LC_ALL': 'C'}, # should be the same as the former. Not be used except in reset_cmd_locale()
}

0 comments on commit 367c8d7

Please sign in to comment.