From 473fa98eda0d79485b05693bf30ee1d9a55c7576 Mon Sep 17 00:00:00 2001
From: grossmj <grossmj@gns3.net>
Date: Thu, 11 Jan 2024 23:11:56 +1100
Subject: [PATCH] Do not stop searching for Qemu binaries if one binary cannot
 be executed. Ref #2306

---
 gns3server/compute/qemu/__init__.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gns3server/compute/qemu/__init__.py b/gns3server/compute/qemu/__init__.py
index 542611d5..9e915fb8 100644
--- a/gns3server/compute/qemu/__init__.py
+++ b/gns3server/compute/qemu/__init__.py
@@ -160,13 +160,20 @@ class Qemu(BaseManager):
                             for arch in archs:
                                 if f.endswith(arch) or f.endswith("{}.exe".format(arch)) or f.endswith("{}w.exe".format(arch)):
                                     qemu_path = os.path.join(path, f)
-                                    version = await Qemu.get_qemu_version(qemu_path)
+                                    try:
+                                        version = await Qemu.get_qemu_version(qemu_path)
+                                    except QemuError as e:
+                                        log.warning(str(e))
+                                        continue
                                     qemus.append({"path": qemu_path, "version": version})
                         else:
                             qemu_path = os.path.join(path, f)
-                            version = await Qemu.get_qemu_version(qemu_path)
+                            try:
+                                version = await Qemu.get_qemu_version(qemu_path)
+                            except QemuError as e:
+                                log.warning(str(e))
+                                continue
                             qemus.append({"path": qemu_path, "version": version})
-
             except OSError:
                 continue