Define an standard locale for all the commands executed (#827)
* Define an standard locale for all the commands executed inside the application * Allow LC_ALL to be overriden during call * flake8 corrections
This commit is contained in:
parent
e32cf71ae7
commit
a8862e9b24
|
|
@ -188,7 +188,8 @@ class SysCommandWorker:
|
|||
self.cmd = cmd
|
||||
self.callbacks = callbacks
|
||||
self.peak_output = peak_output
|
||||
self.environment_vars = environment_vars
|
||||
# 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.logfile = logfile
|
||||
self.working_directory = working_directory
|
||||
|
||||
|
|
@ -368,7 +369,7 @@ class SysCommand:
|
|||
peak_output :Optional[bool] = False,
|
||||
environment_vars :Optional[Dict[str, Any]] = None,
|
||||
working_directory :Optional[str] = './'):
|
||||
|
||||
|
||||
_callbacks = {}
|
||||
if callbacks:
|
||||
for hook, func in callbacks.items():
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ class luks2:
|
|||
raise OSError(2, f"Could not import {path} as a disk encryption key, file is missing.", str(path))
|
||||
|
||||
log(f'Adding additional key-file {path} for {self.partition}', level=logging.INFO)
|
||||
|
||||
worker = SysCommandWorker(f"/usr/bin/cryptsetup -q -v luksAddKey {self.partition.path} {path}")
|
||||
worker = SysCommandWorker(f"/usr/bin/cryptsetup -q -v luksAddKey {self.partition.path} {path}",
|
||||
environment_vars={'LC_ALL':'C'})
|
||||
pw_injected = False
|
||||
while worker.is_alive():
|
||||
if b'Enter any existing passphrase' in worker and pw_injected is False:
|
||||
|
|
|
|||
Loading…
Reference in New Issue