h
This commit is contained in:
BIN
docs/img/hydrus/review-services.png
Normal file
BIN
docs/img/hydrus/review-services.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
@@ -137,6 +137,9 @@ def parse_requirements_file(req_path: Path) -> List[str]:
|
|||||||
|
|
||||||
|
|
||||||
def verify_imports(venv_py: Path, packages: List[str]) -> bool:
|
def verify_imports(venv_py: Path, packages: List[str]) -> bool:
|
||||||
|
# Skip mpv check as it is problematic to install and causes slow startups
|
||||||
|
packages = [p for p in packages if p.lower() != "mpv"]
|
||||||
|
|
||||||
# Map some package names to import names (handle common cases where package name differs from import name)
|
# Map some package names to import names (handle common cases where package name differs from import name)
|
||||||
import_map = {
|
import_map = {
|
||||||
"pyyaml": "yaml",
|
"pyyaml": "yaml",
|
||||||
@@ -150,7 +153,6 @@ def verify_imports(venv_py: Path, packages: List[str]) -> bool:
|
|||||||
"service-identity": "service_identity",
|
"service-identity": "service_identity",
|
||||||
"show-in-file-manager": "showinfm",
|
"show-in-file-manager": "showinfm",
|
||||||
"opencv-python-headless": "cv2",
|
"opencv-python-headless": "cv2",
|
||||||
"mpv": "mpv",
|
|
||||||
"pyside6": "PySide6",
|
"pyside6": "PySide6",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1018,16 +1020,29 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|||||||
print("Failed to launch client detached:", exc)
|
print("Failed to launch client detached:", exc)
|
||||||
return 5
|
return 5
|
||||||
else:
|
else:
|
||||||
|
p = None
|
||||||
try:
|
try:
|
||||||
# If headless on Windows, ensure no window shows even for foreground run
|
# On Windows, if we are already using pythonw.exe, we don't need CREATE_NO_WINDOW
|
||||||
|
# as the process already has no console. Avoiding extra flags helps with
|
||||||
|
# service termination mapping.
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if os.name == "nt" and headless:
|
if os.name == "nt" and headless and "pythonw.exe" not in str(venv_py).lower():
|
||||||
kwargs["creationflags"] = 0x08000000
|
kwargs["creationflags"] = 0x08000000
|
||||||
subprocess.run(cmd, cwd=str(cwd), env=env, **kwargs)
|
|
||||||
return 0
|
p = subprocess.Popen(cmd, cwd=str(cwd), env=env, **kwargs)
|
||||||
except subprocess.CalledProcessError as e:
|
p.wait()
|
||||||
print("hydrus client exited non-zero:", e)
|
return p.returncode
|
||||||
|
except Exception as e:
|
||||||
|
if not args.quiet:
|
||||||
|
print(f"Hydrus client error: {e}")
|
||||||
return 5
|
return 5
|
||||||
|
finally:
|
||||||
|
# Ensure the child process is terminated if the monitor process is killed
|
||||||
|
if p and p.poll() is None:
|
||||||
|
try:
|
||||||
|
p.terminate()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user