From ad47ffbe2984835488c7d77c3c0ea9bb802f1f22 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 19 Sep 2023 18:14:05 +0700 Subject: [PATCH] Force English output for VBoxManage. Fixes #2266 --- gns3server/compute/virtualbox/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gns3server/compute/virtualbox/__init__.py b/gns3server/compute/virtualbox/__init__.py index 2ae0b729..48ed12ae 100644 --- a/gns3server/compute/virtualbox/__init__.py +++ b/gns3server/compute/virtualbox/__init__.py @@ -109,9 +109,16 @@ class VirtualBox(BaseManager): command = [vboxmanage_path, "--nologo", subcommand] command.extend(args) 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)) 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: raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))