Force English output for VBoxManage. Fixes #2266

This commit is contained in:
grossmj 2023-09-19 18:14:05 +07:00
parent 702fea89fb
commit ad47ffbe29

View File

@ -109,9 +109,16 @@ class VirtualBox(BaseManager):
command = [vboxmanage_path, "--nologo", subcommand] command = [vboxmanage_path, "--nologo", subcommand]
command.extend(args) command.extend(args)
command_string = " ".join(command) command_string = " ".join(command)
env = os.environ.copy()
env["LANG"] = "en" # force english output because we rely on it to parse the output
log.info("Executing VBoxManage with command: {}".format(command_string)) log.info("Executing VBoxManage with command: {}".format(command_string))
try: try:
process = await asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) process = await asyncio.create_subprocess_exec(
*command,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
env=env
)
except (OSError, subprocess.SubprocessError) as e: except (OSError, subprocess.SubprocessError) as e:
raise VirtualBoxError("Could not execute VBoxManage: {}".format(e)) raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))