Sfoglia il codice sorgente

Default to None if bun/fnm version is Invalid (#2940)

Elijah Ahianyo 1 anno fa
parent
commit
b34c97d725
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 11 0
      reflex/utils/prerequisites.py

+ 11 - 0
reflex/utils/prerequisites.py

@@ -127,6 +127,11 @@ def get_fnm_version() -> version.Version | None:
         return version.parse(result.stdout.split(" ")[1])  # type: ignore
     except (FileNotFoundError, TypeError):
         return None
+    except version.InvalidVersion as e:
+        console.warn(
+            f"The detected fnm version ({e.args[0]}) is not valid. Defaulting to None."
+        )
+        return None
 
 
 def get_bun_version() -> version.Version | None:
@@ -141,6 +146,11 @@ def get_bun_version() -> version.Version | None:
         return version.parse(result.stdout)  # type: ignore
     except FileNotFoundError:
         return None
+    except version.InvalidVersion as e:
+        console.warn(
+            f"The detected bun version ({e.args[0]}) is not valid. Defaulting to None."
+        )
+        return None
 
 
 def get_install_package_manager() -> str | None:
@@ -854,6 +864,7 @@ def validate_bun():
     # This is specific to non-FHS OS
     bun_path = get_config().bun_path
     if bun_path != constants.Bun.DEFAULT_PATH:
+        console.info(f"Using custom Bun path: {bun_path}")
         bun_version = get_bun_version()
         if not bun_version:
             console.error(