Skip to content

Commit

Permalink
Version check update.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Jan 20, 2025
1 parent 64012b0 commit 562097c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion webui/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import shutil
import threading
from time import sleep
Expand Down Expand Up @@ -129,7 +130,13 @@ def get_package_version(package_name: str, logger: mfs.Logger) -> str:
Returns:
str: The package version.
"""
response = os.popen(f"pip list | grep {package_name}").read()
current_os = platform.system().lower()
if current_os == "windows":
command = f"pip list 2>NUL | findstr {package_name}"
else:
command = f"pip list 2>/dev/null | grep {package_name}"

response = os.popen(command).read()
logger.debug("Grepped response: %s", response)
cleared_response = response.replace(" ", "")
logger.debug("Cleared response: %s", cleared_response)
Expand Down

0 comments on commit 562097c

Please sign in to comment.